1
0
mirror of https://github.com/ndarilek/tts-rs.git synced 2024-11-25 11:59:38 +00:00

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

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() }
}