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

Remove unspecified gender in favor of Option.

This commit is contained in:
Nolan Darilek 2022-03-31 13:18:57 -05:00
parent 2b4251f6fa
commit 9bd767629a
2 changed files with 5 additions and 6 deletions

View File

@ -298,9 +298,9 @@ impl Backend for AvFoundation {
let name: CFString = unsafe { msg_send![*v as *const Object, name] };
let gender: i64 = unsafe { msg_send![*v as *const Object, gender] };
let gender = match gender {
0 => Gender::Male,
1 => Gender::Female,
_ => Gender::Unspecified,
0 => Some(Gender::Male),
1 => Some(Gender::Female),
_ => None,
};
let language: CFString = unsafe { msg_send![*v as *const Object, language] };
let language = language.to_string();

View File

@ -704,7 +704,6 @@ impl Drop for Tts {
#[derive(Clone, Copy, Debug)]
pub enum Gender {
Unspecified,
Male,
Female,
}
@ -713,7 +712,7 @@ pub enum Gender {
pub struct Voice {
pub(crate) id: String,
pub(crate) name: String,
pub(crate) gender: Gender,
pub(crate) gender: Option<Gender>,
pub(crate) language: LanguageIdentifier,
}
@ -726,7 +725,7 @@ impl Voice {
self.name.clone()
}
pub fn gender(&self) -> Gender {
pub fn gender(&self) -> Option<Gender> {
self.gender
}