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:
parent
14a721c837
commit
d6508edd12
|
@ -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" }
|
||||
|
||||
|
|
|
@ -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(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user