mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-11-23 07:09:37 +00:00
Implement stop()
.
This commit is contained in:
parent
e24ed9a3a3
commit
863ae0e8c3
|
@ -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())
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user