mirror of https://github.com/ndarilek/tts-rs.git
Don't support voices in AppKit for now.
This commit is contained in:
parent
219cfbbe00
commit
2b4251f6fa
|
@ -209,7 +209,7 @@ impl Backend for AppKit {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_voice(&mut self, voice: &Voice) -> Result<(), Error> {
|
fn set_voice(&mut self, _voice: &Voice) -> Result<(), Error> {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
use cocoa_foundation::base::{id, nil};
|
|
||||||
use cocoa_foundation::foundation::NSString;
|
|
||||||
use core_foundation::array::CFArray;
|
|
||||||
use core_foundation::string::CFString;
|
|
||||||
use objc::runtime::*;
|
|
||||||
use objc::*;
|
|
||||||
|
|
||||||
use crate::backends::AvFoundation;
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
|
||||||
pub(crate) struct AVSpeechSynthesisVoice(*const Object);
|
|
||||||
|
|
||||||
impl AVSpeechSynthesisVoice {
|
|
||||||
pub fn new() -> Self {
|
|
||||||
let voice: *const Object;
|
|
||||||
unsafe {
|
|
||||||
voice = msg_send![class!(AVSpeechSynthesisVoice), new];
|
|
||||||
};
|
|
||||||
AVSpeechSynthesisVoice { 0: voice }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*impl voices::Backend for AVSpeechSynthesisVoice {
|
|
||||||
type Backend = AvFoundation;
|
|
||||||
|
|
||||||
fn from_id(id: String) -> Self {
|
|
||||||
unimplemented!()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn from_language(lang: voices::LanguageIdentifier) -> Self {
|
|
||||||
unimplemented!()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn list() -> Vec<Self> {
|
|
||||||
let voices: CFArray = unsafe { msg_send![class!(AVSpeechSynthesisVoice), speechVoices] };
|
|
||||||
voices
|
|
||||||
.iter()
|
|
||||||
.map(|v| AVSpeechSynthesisVoice {
|
|
||||||
0: *v as *const Object,
|
|
||||||
})
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn name(self) -> String {
|
|
||||||
let name: CFString = unsafe { msg_send![self.0, name] };
|
|
||||||
name.to_string()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn gender(self) -> Gender {
|
|
||||||
let gender: i64 = unsafe { msg_send![self.0, gender] };
|
|
||||||
match gender {
|
|
||||||
1 => Gender::Male,
|
|
||||||
2 => Gender::Female,
|
|
||||||
_ => Gender::Other,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn id(self) -> String {
|
|
||||||
let identifier: CFString = unsafe { msg_send![self.0, identifier] };
|
|
||||||
identifier.to_string()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn language(self) -> voices::LanguageIdentifier {
|
|
||||||
let lang: CFString = unsafe { msg_send![self.0, language] };
|
|
||||||
lang.to_string().parse().unwrap()
|
|
||||||
}
|
|
||||||
}*/
|
|
Loading…
Reference in New Issue