1
0
mirror of https://github.com/ndarilek/tts-rs.git synced 2024-11-17 11:49:37 +00:00

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::*;
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<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!()
}
}

View File

@ -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<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!()
}
}

View File

@ -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()
}
}
}*/