FFI: Allow determining TTS supported Features from C/C++

This commit is contained in:
mcb2003 2020-12-12 16:59:07 +00:00 committed by michael Connor buchan
parent 3b1994ab36
commit f6546303f8
1 changed files with 8 additions and 1 deletions

View File

@ -5,7 +5,7 @@ use std::{
ptr,
};
use crate::{Backends, TTS};
use crate::{Backends, Features, TTS};
thread_local! {
/// Stores the last reported error, so it can be retrieved at will from C
@ -77,3 +77,10 @@ pub extern "C" fn tts_free(tts: *mut TTS) {
Box::from_raw(tts); // Goes out of scope and is dropped
}
}
/// Returns the features supported by this TTS engine.
/// tts must be a valid pointer to a TTS object.
#[no_mangle]
pub extern "C" fn tts_supported_features(tts: *mut TTS) -> Features {
unsafe { tts.as_ref().unwrap().supported_features() }
}