1
0
mirror of https://github.com/ndarilek/tts-rs.git synced 2024-11-17 12:19:37 +00:00

Remove workaround for incorrect Tolk string handling, pin minimum working version, and bump version.

This commit is contained in:
Nolan Darilek 2020-09-21 15:13:22 -05:00
parent 14a721c837
commit d6508edd12
2 changed files with 3 additions and 21 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "tts"
version = "0.6.3"
version = "0.6.4"
authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
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" }

View File

@ -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(())
}