Implement `stop()`.

This commit is contained in:
Nolan Darilek 2018-12-28 14:49:02 +00:00
parent e24ed9a3a3
commit 863ae0e8c3
2 changed files with 11 additions and 0 deletions

View File

@ -38,6 +38,11 @@ impl Backend for SpeechDispatcher {
self.0.say(Priority::Important, text);
}
fn stop(&self) {
trace!("stop()");
self.0.cancel();
}
fn get_rate(&self) -> u8 {
i32_to_u8(self.0.get_voice_rate())
}

View File

@ -9,6 +9,7 @@ pub enum Backends {
trait Backend {
fn speak(&self, text: &str, interrupt: bool);
fn stop(&self);
fn get_rate(&self) -> u8;
fn set_rate(&self, rate: u8);
fn get_pitch(&self) -> u8;
@ -32,6 +33,11 @@ impl TTS {
self
}
pub fn stop(&self) -> &Self {
self.0.stop();
self
}
pub fn get_rate(&self) -> u8 {
self.0.get_rate()
}