From d6508edd12b996e1e73f1d0f9c7ee0efee77a8fa Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Mon, 21 Sep 2020 15:13:22 -0500 Subject: [PATCH] Remove workaround for incorrect Tolk string handling, pin minimum working version, and bump version. --- Cargo.toml | 4 ++-- src/backends/tolk.rs | 20 +------------------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8ecb3f0..082c2a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tts" -version = "0.6.3" +version = "0.6.4" authors = ["Nolan Darilek "] repository = "https://github.com/ndarilek/tts-rs" description = "High-level Text-To-Speech (TTS) interface" @@ -20,7 +20,7 @@ thiserror = "1" env_logger = "0.7" [target.'cfg(windows)'.dependencies] -tolk = "0.2" +tolk = ">= 0.2.1" winrt = "0.7" tts_winrt_bindings = { version = "0.1", path="winrt_bindings" } diff --git a/src/backends/tolk.rs b/src/backends/tolk.rs index c71cdfa..370da65 100644 --- a/src/backends/tolk.rs +++ b/src/backends/tolk.rs @@ -28,25 +28,7 @@ impl Backend for Tolk { fn speak(&mut self, text: &str, interrupt: bool) -> Result<(), Error> { trace!("speak({}, {})", text, interrupt); - const BUFFER_LENGTH: usize = 300; - if text.len() <= BUFFER_LENGTH { - self.0.speak(text, interrupt); - } else { - if interrupt { - self.stop()?; - } - let tokens = text.split_whitespace(); - let mut buffer = String::new(); - for token in tokens { - if buffer.len() + token.len() > BUFFER_LENGTH { - self.0.speak(buffer, false); - buffer = String::new(); - } else { - buffer.push_str(token); - buffer.push(' '); - } - } - } + self.0.speak(text, interrupt); Ok(()) }