1
0
mirror of https://github.com/ndarilek/tts-rs.git synced 2024-11-09 10:49:36 +00:00

Support stopping.

This commit is contained in:
Nolan Darilek 2020-12-30 09:49:13 -06:00
parent 22ee9863d6
commit e1c2171833

View File

@ -107,7 +107,7 @@ impl Backend for Android {
fn supported_features(&self) -> Features {
Features {
stop: false,
stop: true,
rate: false,
pitch: false,
volume: false,
@ -148,7 +148,16 @@ impl Backend for Android {
}
fn stop(&mut self) -> Result<(), Error> {
todo!()
let vm = Self::vm()?;
let env = vm.get_env()?;
let tts = self.tts.as_obj();
let rv = env.call_method(tts, "stop", "()I", &[])?;
let rv = rv.i()? as i32;
if rv == 0 {
Ok(())
} else {
Err(Error::OperationFailed)
}
}
fn min_rate(&self) -> f32 {