From 1c1f38b55db7f36cb241de4f775f6484a55bffc9 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Tue, 10 Sep 2019 10:41:28 -0500 Subject: [PATCH] Use new Tolk library and update backend. --- Cargo.toml | 4 ++-- examples/hello_world.rs | 3 +++ src/backends/tolk.rs | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5185aab..0c0f7d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tts" -version = "0.1.1" +version = "0.2.0" authors = ["Nolan Darilek "] repository = "https://gitlab.com/ndarilek/tts-rs" description = "High-level Text-To-Speech (TTS) interface" @@ -16,7 +16,7 @@ log = "0.4" env_logger = "0.6" [target.'cfg(windows)'.dependencies] -tolk = { git = "https://github.com/ndarilek/tolk-rs" } +tolk = "0.2" [target.'cfg(target_os = "linux")'.dependencies] speech-dispatcher = "0.3" diff --git a/examples/hello_world.rs b/examples/hello_world.rs index f5886ea..e61cd3b 100644 --- a/examples/hello_world.rs +++ b/examples/hello_world.rs @@ -1,3 +1,4 @@ +use std::io; use std::u8; use tts::*; @@ -35,5 +36,7 @@ fn main() -> Result<(), std::io::Error> { tts.set_volume(original_volume)?; } tts.speak("Goodbye.", false)?; + let mut _input = String::new(); + io::stdin().read_line(&mut _input)?; Ok(()) } diff --git a/src/backends/tolk.rs b/src/backends/tolk.rs index 5e93850..9e4d6b9 100644 --- a/src/backends/tolk.rs +++ b/src/backends/tolk.rs @@ -10,6 +10,7 @@ impl Tolk { pub fn new() -> impl Backend { info!("Initializing Tolk backend"); let tolk = TolkPtr::new(); + tolk.try_sapi(true); Tolk(tolk) } } @@ -17,7 +18,7 @@ impl Tolk { impl Backend for Tolk { fn supported_features(&self) -> Features { Features { - stop: false, + stop: true, rate: false, pitch: false, volume: false, @@ -32,7 +33,8 @@ impl Backend for Tolk { fn stop(&self) -> Result<(), Error> { trace!("stop()"); - unimplemented!(); + self.0.silence(); + Ok(()) } fn get_rate(&self) -> Result {