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

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); self.0.say(Priority::Important, text);
} }
fn stop(&self) {
trace!("stop()");
self.0.cancel();
}
fn get_rate(&self) -> u8 { fn get_rate(&self) -> u8 {
i32_to_u8(self.0.get_voice_rate()) i32_to_u8(self.0.get_voice_rate())
} }

View File

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