diff --git a/src/backends/appkit.rs b/src/backends/appkit.rs index 389418d..3df4bfb 100644 --- a/src/backends/appkit.rs +++ b/src/backends/appkit.rs @@ -7,7 +7,7 @@ use objc::declare::ClassDecl; use objc::runtime::*; use objc::*; -use crate::{Backend, BackendId, Error, Features, UtteranceId}; +use crate::{Backend, BackendId, Error, Features, UtteranceId, Voice}; #[derive(Clone, Debug)] pub(crate) struct AppKit(*mut Object, *mut Object); @@ -201,15 +201,15 @@ impl Backend for AppKit { Ok(is_speaking != NO as i8) } - fn voice(&self) -> Result { + fn voice(&self) -> Result, Error> { unimplemented!() } - fn list_voices(&self) -> Vec { + fn voices(&self) -> Result, Error> { unimplemented!() } - fn set_voice(&mut self, voice: &str) -> Result<(), Error> { + fn set_voice(&mut self, voice: &Voice) -> Result<(), Error> { unimplemented!() } } diff --git a/src/backends/av_foundation.rs b/src/backends/av_foundation.rs index 9e79a47..24c8653 100644 --- a/src/backends/av_foundation.rs +++ b/src/backends/av_foundation.rs @@ -9,8 +9,7 @@ use log::{info, trace}; use objc::runtime::{Object, Sel}; use objc::{class, declare::ClassDecl, msg_send, sel, sel_impl}; -use crate::voices::Backend as VoiceBackend; -use crate::{Backend, BackendId, Error, Features, UtteranceId, CALLBACKS}; +use crate::{Backend, BackendId, Error, Features, UtteranceId, Voice, CALLBACKS}; mod voices; use voices::*; @@ -167,7 +166,8 @@ impl Backend for AvFoundation { pitch: true, volume: true, is_speaking: true, - voices: true, + voice: true, + get_voice: true, utterance_callbacks: true, } } @@ -280,20 +280,16 @@ impl Backend for AvFoundation { Ok(is_speaking != NO as i8) } - fn voice(&self) -> Result { - Ok(self.voice.id()) + fn voice(&self) -> Result, Error> { + unimplemented!() } - fn list_voices(&self) -> Vec { - AVSpeechSynthesisVoice::list() - .iter() - .map(|v| v.id()) - .collect() + fn voices(&self) -> Result, Error> { + unimplemented!() } - fn set_voice(&mut self, voice: &str) -> Result<(), Error> { - self.voice = AVSpeechSynthesisVoice::new(); - Ok(()) + fn set_voice(&mut self, voice: &Voice) -> Result<(), Error> { + unimplemented!() } } diff --git a/src/backends/av_foundation/voices.rs b/src/backends/av_foundation/voices.rs index 836adc7..3df9b69 100644 --- a/src/backends/av_foundation/voices.rs +++ b/src/backends/av_foundation/voices.rs @@ -6,8 +6,6 @@ use objc::runtime::*; use objc::*; use crate::backends::AvFoundation; -use crate::voices; -use crate::voices::Gender; #[derive(Copy, Clone, Debug)] pub(crate) struct AVSpeechSynthesisVoice(*const Object); @@ -22,7 +20,7 @@ impl AVSpeechSynthesisVoice { } } -impl voices::Backend for AVSpeechSynthesisVoice { +/*impl voices::Backend for AVSpeechSynthesisVoice { type Backend = AvFoundation; fn from_id(id: String) -> Self { @@ -66,4 +64,4 @@ impl voices::Backend for AVSpeechSynthesisVoice { let lang: CFString = unsafe { msg_send![self.0, language] }; lang.to_string().parse().unwrap() } -} +}*/