mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-11-25 14:39:37 +00:00
FFI: Implement tts_stop() function.
This commit is contained in:
parent
05a065c6d3
commit
0905f6d6c6
15
src/ffi.rs
15
src/ffi.rs
|
@ -130,3 +130,18 @@ pub extern "C" fn tts_free_utterance(utterance: *mut UtteranceId) {
|
||||||
Box::from_raw(utterance);
|
Box::from_raw(utterance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// Stops current speech.
|
||||||
|
/// Returns true on success, false on error or if `tts` is NULL.
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn tts_stop(tts: *mut TTS) -> bool {
|
||||||
|
if tts.is_null() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
match unsafe { tts.as_mut().unwrap().stop() } {
|
||||||
|
Ok(_) => true,
|
||||||
|
Err(e) => {
|
||||||
|
set_last_error(e.to_string()).unwrap();
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user