mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-11-25 05:29:36 +00:00
FFI: Pass pointer to uninit Features struct in tts_supported_features()
This is done because the ABI for returning struct values isn't well defined.
This commit is contained in:
parent
1597797c57
commit
f39f86aa13
|
@ -7,7 +7,7 @@ use std::{
|
||||||
ptr,
|
ptr,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{Backends, Features, UtteranceId, Tts};
|
use crate::{Backends, Features, Tts, UtteranceId};
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
/// Stores the last reported error, so it can be retrieved at will from C
|
/// Stores the last reported error, so it can be retrieved at will from C
|
||||||
|
@ -78,11 +78,12 @@ pub unsafe extern "C" fn tts_free(tts: *mut Tts) {
|
||||||
Box::from_raw(tts); // Goes out of scope and is dropped
|
Box::from_raw(tts); // Goes out of scope and is dropped
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the features supported by this Tts engine.
|
/// Returns the features supported by this Tts engine in the object specified by `features`.
|
||||||
/// `tts` must be a valid pointer to a Tts object.
|
/// `tts` must be a valid pointer to a Tts object.
|
||||||
|
/// `features` must be a valid pointer to an uninitialized `Features` object.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn tts_supported_features(tts: *const Tts) -> Features {
|
pub unsafe extern "C" fn tts_supported_features(tts: *const Tts, features: *mut Features) {
|
||||||
tts.as_ref().unwrap().supported_features()
|
*features = tts.as_ref().unwrap().supported_features()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Speaks the specified text, optionally interrupting current speech.
|
/// Speaks the specified text, optionally interrupting current speech.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user