mirror of https://github.com/ndarilek/tts-rs.git
fix return type of AVSpeechSynthesisVoice:new
This commit is contained in:
parent
1b8809aaeb
commit
b238c8c938
|
@ -11,10 +11,12 @@ pub struct AVSpeechSynthesisVoice(*const Object);
|
||||||
|
|
||||||
impl AVSpeechSynthesisVoice {
|
impl AVSpeechSynthesisVoice {
|
||||||
pub fn new(identifier: &str) -> Self {
|
pub fn new(identifier: &str) -> Self {
|
||||||
|
let voice: *const Object;
|
||||||
unsafe{
|
unsafe{
|
||||||
let i: id = NSString::alloc(nil).init_str(identifier);
|
let i: id = NSString::alloc(nil).init_str(identifier);
|
||||||
msg_send![class!(AVSpeechSynthesisVoice), voiceWithIdentifier:i]
|
voice = msg_send![class!(AVSpeechSynthesisVoice), voiceWithIdentifier:i];
|
||||||
}
|
};
|
||||||
|
AVSpeechSynthesisVoice{0:voice}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn default() -> Self {
|
pub fn default() -> Self {
|
||||||
|
@ -24,7 +26,7 @@ impl AVSpeechSynthesisVoice {
|
||||||
pub fn list() -> Vec<Self> {
|
pub fn list() -> Vec<Self> {
|
||||||
let voices: CFArray = unsafe{msg_send![class!(AVSpeechSynthesisVoice), speechVoices]};
|
let voices: CFArray = unsafe{msg_send![class!(AVSpeechSynthesisVoice), speechVoices]};
|
||||||
voices.iter().map(|v| {
|
voices.iter().map(|v| {
|
||||||
AVSpeechSynthesisVoice{0: *v as *mut Object}
|
AVSpeechSynthesisVoice{0: *v as *const Object}
|
||||||
}).collect()
|
}).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue