Browse Source

Stub out methods for now.

pull/26/head
Nolan Darilek 4 months ago
parent
commit
e3542abd7c
  1. 8
      src/backends/appkit.rs
  2. 22
      src/backends/av_foundation.rs
  3. 6
      src/backends/av_foundation/voices.rs

8
src/backends/appkit.rs

@ -7,7 +7,7 @@ use objc::declare::ClassDecl; @@ -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 { @@ -201,15 +201,15 @@ impl Backend for AppKit {
Ok(is_speaking != NO as i8)
}
fn voice(&self) -> Result<String, Error> {
fn voice(&self) -> Result<Option<Voice>, Error> {
unimplemented!()
}
fn list_voices(&self) -> Vec<String> {
fn voices(&self) -> Result<Vec<Voice>, Error> {
unimplemented!()
}
fn set_voice(&mut self, voice: &str) -> Result<(), Error> {
fn set_voice(&mut self, voice: &Voice) -> Result<(), Error> {
unimplemented!()
}
}

22
src/backends/av_foundation.rs

@ -9,8 +9,7 @@ use log::{info, trace}; @@ -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 { @@ -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 { @@ -280,20 +280,16 @@ impl Backend for AvFoundation {
Ok(is_speaking != NO as i8)
}
fn voice(&self) -> Result<String, Error> {
Ok(self.voice.id())
fn voice(&self) -> Result<Option<Voice>, Error> {
unimplemented!()
}
fn list_voices(&self) -> Vec<String> {
AVSpeechSynthesisVoice::list()
.iter()
.map(|v| v.id())
.collect()
fn voices(&self) -> Result<Vec<Voice>, 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!()
}
}

6
src/backends/av_foundation/voices.rs

@ -6,8 +6,6 @@ use objc::runtime::*; @@ -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 { @@ -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 { @@ -66,4 +64,4 @@ impl voices::Backend for AVSpeechSynthesisVoice {
let lang: CFString = unsafe { msg_send![self.0, language] };
lang.to_string().parse().unwrap()
}
}
}*/

Loading…
Cancel
Save