Stub out methods for now.

This commit is contained in:
Nolan Darilek 2022-03-31 11:52:30 -05:00
parent 55c0fbbd2b
commit e3542abd7c
3 changed files with 15 additions and 21 deletions

View File

@ -7,7 +7,7 @@ use objc::declare::ClassDecl;
use objc::runtime::*; use objc::runtime::*;
use objc::*; use objc::*;
use crate::{Backend, BackendId, Error, Features, UtteranceId}; use crate::{Backend, BackendId, Error, Features, UtteranceId, Voice};
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub(crate) struct AppKit(*mut Object, *mut Object); pub(crate) struct AppKit(*mut Object, *mut Object);
@ -201,15 +201,15 @@ impl Backend for AppKit {
Ok(is_speaking != NO as i8) Ok(is_speaking != NO as i8)
} }
fn voice(&self) -> Result<String, Error> { fn voice(&self) -> Result<Option<Voice>, Error> {
unimplemented!() unimplemented!()
} }
fn list_voices(&self) -> Vec<String> { fn voices(&self) -> Result<Vec<Voice>, Error> {
unimplemented!() unimplemented!()
} }
fn set_voice(&mut self, voice: &str) -> Result<(), Error> { fn set_voice(&mut self, voice: &Voice) -> Result<(), Error> {
unimplemented!() unimplemented!()
} }
} }

View File

@ -9,8 +9,7 @@ use log::{info, trace};
use objc::runtime::{Object, Sel}; use objc::runtime::{Object, Sel};
use objc::{class, declare::ClassDecl, msg_send, sel, sel_impl}; use objc::{class, declare::ClassDecl, msg_send, sel, sel_impl};
use crate::voices::Backend as VoiceBackend; use crate::{Backend, BackendId, Error, Features, UtteranceId, Voice, CALLBACKS};
use crate::{Backend, BackendId, Error, Features, UtteranceId, CALLBACKS};
mod voices; mod voices;
use voices::*; use voices::*;
@ -167,7 +166,8 @@ impl Backend for AvFoundation {
pitch: true, pitch: true,
volume: true, volume: true,
is_speaking: true, is_speaking: true,
voices: true, voice: true,
get_voice: true,
utterance_callbacks: true, utterance_callbacks: true,
} }
} }
@ -280,20 +280,16 @@ impl Backend for AvFoundation {
Ok(is_speaking != NO as i8) Ok(is_speaking != NO as i8)
} }
fn voice(&self) -> Result<String, Error> { fn voice(&self) -> Result<Option<Voice>, Error> {
Ok(self.voice.id()) unimplemented!()
} }
fn list_voices(&self) -> Vec<String> { fn voices(&self) -> Result<Vec<Voice>, Error> {
AVSpeechSynthesisVoice::list() unimplemented!()
.iter()
.map(|v| v.id())
.collect()
} }
fn set_voice(&mut self, voice: &str) -> Result<(), Error> { fn set_voice(&mut self, voice: &Voice) -> Result<(), Error> {
self.voice = AVSpeechSynthesisVoice::new(); unimplemented!()
Ok(())
} }
} }

View File

@ -6,8 +6,6 @@ use objc::runtime::*;
use objc::*; use objc::*;
use crate::backends::AvFoundation; use crate::backends::AvFoundation;
use crate::voices;
use crate::voices::Gender;
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
pub(crate) struct AVSpeechSynthesisVoice(*const Object); 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; type Backend = AvFoundation;
fn from_id(id: String) -> Self { fn from_id(id: String) -> Self {
@ -66,4 +64,4 @@ impl voices::Backend for AVSpeechSynthesisVoice {
let lang: CFString = unsafe { msg_send![self.0, language] }; let lang: CFString = unsafe { msg_send![self.0, language] };
lang.to_string().parse().unwrap() lang.to_string().parse().unwrap()
} }
} }*/