mirror of https://github.com/ndarilek/tts-rs.git
Bump speech-dispatcher dependency and update for new return types.
This commit is contained in:
parent
1f466275cf
commit
dc00aa427f
|
@ -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"] }
|
windows = { version = "0.29", features = ["alloc", "std", "Foundation", "Media_Core", "Media_Playback", "Media_SpeechSynthesis", "Storage_Streams"] }
|
||||||
|
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
speech-dispatcher = "0.9"
|
speech-dispatcher = "0.10"
|
||||||
|
|
||||||
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
|
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
|
||||||
cocoa-foundation = "0.1"
|
cocoa-foundation = "0.1"
|
||||||
|
|
|
@ -92,11 +92,11 @@ impl Backend for SpeechDispatcher {
|
||||||
}
|
}
|
||||||
let single_char = text.to_string().capacity() == 1;
|
let single_char = text.to_string().capacity() == 1;
|
||||||
if single_char {
|
if single_char {
|
||||||
self.0.set_punctuation(Punctuation::All);
|
self.0.set_punctuation(Punctuation::All)?;
|
||||||
}
|
}
|
||||||
let id = self.0.say(Priority::Important, text);
|
let id = self.0.say(Priority::Important, text);
|
||||||
if single_char {
|
if single_char {
|
||||||
self.0.set_punctuation(Punctuation::None);
|
self.0.set_punctuation(Punctuation::None)?;
|
||||||
}
|
}
|
||||||
if let Some(id) = id {
|
if let Some(id) = id {
|
||||||
Ok(Some(UtteranceId::SpeechDispatcher(id)))
|
Ok(Some(UtteranceId::SpeechDispatcher(id)))
|
||||||
|
@ -107,7 +107,7 @@ impl Backend for SpeechDispatcher {
|
||||||
|
|
||||||
fn stop(&mut self) -> Result<(), Error> {
|
fn stop(&mut self) -> Result<(), Error> {
|
||||||
trace!("stop()");
|
trace!("stop()");
|
||||||
self.0.cancel();
|
self.0.cancel()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ impl Backend for SpeechDispatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_rate(&mut self, rate: f32) -> Result<(), Error> {
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ impl Backend for SpeechDispatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_pitch(&mut self, pitch: f32) -> Result<(), Error> {
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ impl Backend for SpeechDispatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_volume(&mut self, volume: f32) -> Result<(), Error> {
|
fn set_volume(&mut self, volume: f32) -> Result<(), Error> {
|
||||||
self.0.set_volume(volume as i32);
|
self.0.set_volume(volume as i32)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ use libc::c_char;
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
use objc::{class, msg_send, sel, sel_impl};
|
use objc::{class, msg_send, sel, sel_impl};
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
use speech_dispatcher::SpeechDispatcherError;
|
use speech_dispatcher::{Error as SpeechDispatcherError};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
#[cfg(all(windows, feature = "tolk"))]
|
#[cfg(all(windows, feature = "tolk"))]
|
||||||
use tolk::Tolk;
|
use tolk::Tolk;
|
||||||
|
|
Loading…
Reference in New Issue