mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-09-28 02:09:43 +00:00
Compare commits
No commits in common. "eb1d13976a373e66119901f97b4a9a328797f6e8" and "b4f48fa439159cd26405d495f6a9baeafc7f703a" have entirely different histories.
eb1d13976a
...
b4f48fa439
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "tts"
|
name = "tts"
|
||||||
version = "0.24.3"
|
version = "0.24.2"
|
||||||
authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
|
authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
|
||||||
repository = "https://github.com/ndarilek/tts-rs"
|
repository = "https://github.com/ndarilek/tts-rs"
|
||||||
description = "High-level Text-To-Speech (TTS) interface"
|
description = "High-level Text-To-Speech (TTS) interface"
|
||||||
|
|
|
@ -46,15 +46,13 @@ impl AppKit {
|
||||||
) {
|
) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let strings: id = *this.get_ivar("strings");
|
let strings: id = *this.get_ivar("strings");
|
||||||
|
let str: id = msg_send!(strings, firstObject);
|
||||||
|
let _: () = msg_send![str, release];
|
||||||
|
let _: () = msg_send!(strings, removeObjectAtIndex:0);
|
||||||
let count: u32 = msg_send![strings, count];
|
let count: u32 = msg_send![strings, count];
|
||||||
if count > 0 {
|
if count > 0 {
|
||||||
let str: id = msg_send!(strings, firstObject);
|
let str: id = msg_send!(strings, firstObject);
|
||||||
let _: () = msg_send![str, release];
|
let _: BOOL = msg_send![synth, startSpeakingString: str];
|
||||||
let _: () = msg_send!(strings, removeObjectAtIndex:0);
|
|
||||||
if count > 1 {
|
|
||||||
let str: id = msg_send!(strings, firstObject);
|
|
||||||
let _: BOOL = msg_send![synth, startSpeakingString: str];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ use std::{str::FromStr, sync::Mutex};
|
||||||
use cocoa_foundation::base::{id, nil, NO};
|
use cocoa_foundation::base::{id, nil, NO};
|
||||||
use cocoa_foundation::foundation::NSString;
|
use cocoa_foundation::foundation::NSString;
|
||||||
use core_foundation::array::CFArray;
|
use core_foundation::array::CFArray;
|
||||||
use core_foundation::base::TCFType;
|
|
||||||
use core_foundation::string::CFString;
|
use core_foundation::string::CFString;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use log::{info, trace};
|
use log::{info, trace};
|
||||||
|
@ -291,26 +290,19 @@ impl Backend for AvFoundation {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn voices(&self) -> Result<Vec<Voice>, Error> {
|
fn voices(&self) -> Result<Vec<Voice>, Error> {
|
||||||
let voices: CFArray = unsafe {
|
let voices: CFArray = unsafe { msg_send![class!(AVSpeechSynthesisVoice), speechVoices] };
|
||||||
CFArray::wrap_under_get_rule(msg_send![class!(AVSpeechSynthesisVoice), speechVoices])
|
|
||||||
};
|
|
||||||
let rv = voices
|
let rv = voices
|
||||||
.iter()
|
.iter()
|
||||||
.map(|v| {
|
.map(|v| {
|
||||||
let id: CFString = unsafe {
|
let id: CFString = unsafe { msg_send![*v as *const Object, identifier] };
|
||||||
CFString::wrap_under_get_rule(msg_send![*v as *const Object, identifier])
|
let name: CFString = unsafe { msg_send![*v as *const Object, name] };
|
||||||
};
|
|
||||||
let name: CFString =
|
|
||||||
unsafe { CFString::wrap_under_get_rule(msg_send![*v as *const Object, name]) };
|
|
||||||
let gender: i64 = unsafe { msg_send![*v as *const Object, gender] };
|
let gender: i64 = unsafe { msg_send![*v as *const Object, gender] };
|
||||||
let gender = match gender {
|
let gender = match gender {
|
||||||
1 => Some(Gender::Male),
|
1 => Some(Gender::Male),
|
||||||
2 => Some(Gender::Female),
|
2 => Some(Gender::Female),
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
let language: CFString = unsafe {
|
let language: CFString = unsafe { msg_send![*v as *const Object, language] };
|
||||||
CFString::wrap_under_get_rule(msg_send![*v as *const Object, language])
|
|
||||||
};
|
|
||||||
let language = language.to_string();
|
let language = language.to_string();
|
||||||
let language = LanguageIdentifier::from_str(&language).unwrap();
|
let language = LanguageIdentifier::from_str(&language).unwrap();
|
||||||
Voice {
|
Voice {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user