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

Bump speech-dispatcher dependency and update for new return types.

This commit is contained in:
Nolan Darilek 2022-01-10 11:02:12 -06:00
parent 1f466275cf
commit dc00aa427f
3 changed files with 8 additions and 8 deletions

View File

@ -26,7 +26,7 @@ tolk = { version = "0.5", optional = true }
windows = { version = "0.29", features = ["alloc", "std", "Foundation", "Media_Core", "Media_Playback", "Media_SpeechSynthesis", "Storage_Streams"] }
[target.'cfg(target_os = "linux")'.dependencies]
speech-dispatcher = "0.9"
speech-dispatcher = "0.10"
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
cocoa-foundation = "0.1"

View File

@ -92,11 +92,11 @@ impl Backend for SpeechDispatcher {
}
let single_char = text.to_string().capacity() == 1;
if single_char {
self.0.set_punctuation(Punctuation::All);
self.0.set_punctuation(Punctuation::All)?;
}
let id = self.0.say(Priority::Important, text);
if single_char {
self.0.set_punctuation(Punctuation::None);
self.0.set_punctuation(Punctuation::None)?;
}
if let Some(id) = id {
Ok(Some(UtteranceId::SpeechDispatcher(id)))
@ -107,7 +107,7 @@ impl Backend for SpeechDispatcher {
fn stop(&mut self) -> Result<(), Error> {
trace!("stop()");
self.0.cancel();
self.0.cancel()?;
Ok(())
}
@ -128,7 +128,7 @@ impl Backend for SpeechDispatcher {
}
fn set_rate(&mut self, rate: f32) -> Result<(), Error> {
self.0.set_voice_rate(rate as i32);
self.0.set_voice_rate(rate as i32)?;
Ok(())
}
@ -149,7 +149,7 @@ impl Backend for SpeechDispatcher {
}
fn set_pitch(&mut self, pitch: f32) -> Result<(), Error> {
self.0.set_voice_pitch(pitch as i32);
self.0.set_voice_pitch(pitch as i32)?;
Ok(())
}
@ -170,7 +170,7 @@ impl Backend for SpeechDispatcher {
}
fn set_volume(&mut self, volume: f32) -> Result<(), Error> {
self.0.set_volume(volume as i32);
self.0.set_volume(volume as i32)?;
Ok(())
}

View File

@ -28,7 +28,7 @@ use libc::c_char;
#[cfg(target_os = "macos")]
use objc::{class, msg_send, sel, sel_impl};
#[cfg(target_os = "linux")]
use speech_dispatcher::SpeechDispatcherError;
use speech_dispatcher::{Error as SpeechDispatcherError};
use thiserror::Error;
#[cfg(all(windows, feature = "tolk"))]
use tolk::Tolk;