From dc00aa427f3ec4382dc7af18ab7494476f706723 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Mon, 10 Jan 2022 11:02:12 -0600 Subject: [PATCH] Bump speech-dispatcher dependency and update for new return types. --- Cargo.toml | 2 +- src/backends/speech_dispatcher.rs | 12 ++++++------ src/lib.rs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 59b6da4..5f081d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/backends/speech_dispatcher.rs b/src/backends/speech_dispatcher.rs index bd373c4..57ce7b2 100644 --- a/src/backends/speech_dispatcher.rs +++ b/src/backends/speech_dispatcher.rs @@ -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(()) } diff --git a/src/lib.rs b/src/lib.rs index 0d35ba0..0962396 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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;