mirror of https://github.com/ndarilek/tts-rs.git
Remove workaround for incorrect Tolk string handling, pin minimum working version, and bump version.
This commit is contained in:
parent
14a721c837
commit
d6508edd12
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "tts"
|
name = "tts"
|
||||||
version = "0.6.3"
|
version = "0.6.4"
|
||||||
authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
|
authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
|
||||||
repository = "https://github.com/ndarilek/tts-rs"
|
repository = "https://github.com/ndarilek/tts-rs"
|
||||||
description = "High-level Text-To-Speech (TTS) interface"
|
description = "High-level Text-To-Speech (TTS) interface"
|
||||||
|
@ -20,7 +20,7 @@ thiserror = "1"
|
||||||
env_logger = "0.7"
|
env_logger = "0.7"
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
tolk = "0.2"
|
tolk = ">= 0.2.1"
|
||||||
winrt = "0.7"
|
winrt = "0.7"
|
||||||
tts_winrt_bindings = { version = "0.1", path="winrt_bindings" }
|
tts_winrt_bindings = { version = "0.1", path="winrt_bindings" }
|
||||||
|
|
||||||
|
|
|
@ -28,25 +28,7 @@ impl Backend for Tolk {
|
||||||
|
|
||||||
fn speak(&mut self, text: &str, interrupt: bool) -> Result<(), Error> {
|
fn speak(&mut self, text: &str, interrupt: bool) -> Result<(), Error> {
|
||||||
trace!("speak({}, {})", text, interrupt);
|
trace!("speak({}, {})", text, interrupt);
|
||||||
const BUFFER_LENGTH: usize = 300;
|
self.0.speak(text, interrupt);
|
||||||
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(' ');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue