use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub type NSSpeechSynthesizerVoiceName = NSString;
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub type NSVoiceAttributeKey = NSString;
extern "C" {
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub static NSVoiceName: &'static NSVoiceAttributeKey;
}
extern "C" {
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub static NSVoiceIdentifier: &'static NSVoiceAttributeKey;
}
extern "C" {
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub static NSVoiceAge: &'static NSVoiceAttributeKey;
}
extern "C" {
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub static NSVoiceGender: &'static NSVoiceAttributeKey;
}
extern "C" {
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub static NSVoiceDemoText: &'static NSVoiceAttributeKey;
}
extern "C" {
pub static NSVoiceLocaleIdentifier: &'static NSVoiceAttributeKey;
}
extern "C" {
pub static NSVoiceSupportedCharacters: &'static NSVoiceAttributeKey;
}
extern "C" {
pub static NSVoiceIndividuallySpokenCharacters: &'static NSVoiceAttributeKey;
}
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub type NSSpeechDictionaryKey = NSString;
extern "C" {
pub static NSSpeechDictionaryLocaleIdentifier: &'static NSSpeechDictionaryKey;
}
extern "C" {
pub static NSSpeechDictionaryModificationDate: &'static NSSpeechDictionaryKey;
}
extern "C" {
pub static NSSpeechDictionaryPronunciations: &'static NSSpeechDictionaryKey;
}
extern "C" {
pub static NSSpeechDictionaryAbbreviations: &'static NSSpeechDictionaryKey;
}
extern "C" {
pub static NSSpeechDictionaryEntrySpelling: &'static NSSpeechDictionaryKey;
}
extern "C" {
pub static NSSpeechDictionaryEntryPhonemes: &'static NSSpeechDictionaryKey;
}
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub type NSVoiceGenderName = NSString;
extern "C" {
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub static NSVoiceGenderNeuter: &'static NSVoiceGenderName;
}
extern "C" {
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub static NSVoiceGenderMale: &'static NSVoiceGenderName;
}
extern "C" {
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub static NSVoiceGenderFemale: &'static NSVoiceGenderName;
}
extern "C" {
pub static NSVoiceGenderNeutral: &'static NSVoiceGenderName;
}
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub type NSSpeechPropertyKey = NSString;
extern "C" {
pub static NSSpeechStatusProperty: &'static NSSpeechPropertyKey;
}
extern "C" {
pub static NSSpeechErrorsProperty: &'static NSSpeechPropertyKey;
}
extern "C" {
pub static NSSpeechInputModeProperty: &'static NSSpeechPropertyKey;
}
extern "C" {
pub static NSSpeechCharacterModeProperty: &'static NSSpeechPropertyKey;
}
extern "C" {
pub static NSSpeechNumberModeProperty: &'static NSSpeechPropertyKey;
}
extern "C" {
pub static NSSpeechRateProperty: &'static NSSpeechPropertyKey;
}
extern "C" {
pub static NSSpeechPitchBaseProperty: &'static NSSpeechPropertyKey;
}
extern "C" {
pub static NSSpeechPitchModProperty: &'static NSSpeechPropertyKey;
}
extern "C" {
pub static NSSpeechVolumeProperty: &'static NSSpeechPropertyKey;
}
extern "C" {
pub static NSSpeechSynthesizerInfoProperty: &'static NSSpeechPropertyKey;
}
extern "C" {
pub static NSSpeechRecentSyncProperty: &'static NSSpeechPropertyKey;
}
extern "C" {
pub static NSSpeechPhonemeSymbolsProperty: &'static NSSpeechPropertyKey;
}
extern "C" {
pub static NSSpeechCurrentVoiceProperty: &'static NSSpeechPropertyKey;
}
extern "C" {
pub static NSSpeechCommandDelimiterProperty: &'static NSSpeechPropertyKey;
}
extern "C" {
pub static NSSpeechResetProperty: &'static NSSpeechPropertyKey;
}
extern "C" {
pub static NSSpeechOutputToFileURLProperty: &'static NSSpeechPropertyKey;
}
extern "C" {
#[deprecated]
pub static NSVoiceLanguage: &'static NSVoiceAttributeKey;
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSSpeechBoundary(pub NSUInteger);
impl NSSpeechBoundary {
#[doc(alias = "NSSpeechImmediateBoundary")]
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub const ImmediateBoundary: Self = Self(0);
#[doc(alias = "NSSpeechWordBoundary")]
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub const WordBoundary: Self = Self(1);
#[doc(alias = "NSSpeechSentenceBoundary")]
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub const SentenceBoundary: Self = Self(2);
}
unsafe impl Encode for NSSpeechBoundary {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSSpeechBoundary {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub struct NSSpeechSynthesizer;
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSSpeechSynthesizer {}
);
impl NSSpeechSynthesizer {
extern_methods!(
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[unsafe(method(initWithVoice:))]
#[unsafe(method_family = init)]
pub fn initWithVoice(
this: Allocated<Self>,
voice: Option<&NSSpeechSynthesizerVoiceName>,
) -> Option<Retained<Self>>;
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[unsafe(method(startSpeakingString:))]
#[unsafe(method_family = none)]
pub fn startSpeakingString(&self, string: &NSString) -> bool;
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[unsafe(method(startSpeakingString:toURL:))]
#[unsafe(method_family = none)]
pub fn startSpeakingString_toURL(&self, string: &NSString, url: &NSURL) -> bool;
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[unsafe(method(isSpeaking))]
#[unsafe(method_family = none)]
pub fn isSpeaking(&self) -> bool;
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[unsafe(method(stopSpeaking))]
#[unsafe(method_family = none)]
pub fn stopSpeaking(&self);
#[unsafe(method(stopSpeakingAtBoundary:))]
#[unsafe(method_family = none)]
pub fn stopSpeakingAtBoundary(&self, boundary: NSSpeechBoundary);
#[unsafe(method(pauseSpeakingAtBoundary:))]
#[unsafe(method_family = none)]
pub fn pauseSpeakingAtBoundary(&self, boundary: NSSpeechBoundary);
#[unsafe(method(continueSpeaking))]
#[unsafe(method_family = none)]
pub fn continueSpeaking(&self);
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub fn delegate(
&self,
mtm: MainThreadMarker,
) -> Option<Retained<ProtocolObject<dyn NSSpeechSynthesizerDelegate>>>;
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSSpeechSynthesizerDelegate>>,
);
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[unsafe(method(voice))]
#[unsafe(method_family = none)]
pub fn voice(&self) -> Option<Retained<NSSpeechSynthesizerVoiceName>>;
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[unsafe(method(setVoice:))]
#[unsafe(method_family = none)]
pub fn setVoice(&self, voice: Option<&NSSpeechSynthesizerVoiceName>) -> bool;
#[unsafe(method(rate))]
#[unsafe(method_family = none)]
pub fn rate(&self) -> c_float;
#[unsafe(method(setRate:))]
#[unsafe(method_family = none)]
pub fn setRate(&self, rate: c_float);
#[unsafe(method(volume))]
#[unsafe(method_family = none)]
pub fn volume(&self) -> c_float;
#[unsafe(method(setVolume:))]
#[unsafe(method_family = none)]
pub fn setVolume(&self, volume: c_float);
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[unsafe(method(usesFeedbackWindow))]
#[unsafe(method_family = none)]
pub fn usesFeedbackWindow(&self) -> bool;
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[unsafe(method(setUsesFeedbackWindow:))]
#[unsafe(method_family = none)]
pub fn setUsesFeedbackWindow(&self, uses_feedback_window: bool);
#[unsafe(method(addSpeechDictionary:))]
#[unsafe(method_family = none)]
pub unsafe fn addSpeechDictionary(
&self,
speech_dictionary: &NSDictionary<NSSpeechDictionaryKey, AnyObject>,
);
#[unsafe(method(phonemesFromText:))]
#[unsafe(method_family = none)]
pub fn phonemesFromText(&self, text: &NSString) -> Retained<NSString>;
#[unsafe(method(objectForProperty:error:_))]
#[unsafe(method_family = none)]
pub fn objectForProperty_error(
&self,
property: &NSSpeechPropertyKey,
) -> Result<Retained<AnyObject>, Retained<NSError>>;
#[unsafe(method(setObject:forProperty:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn setObject_forProperty_error(
&self,
object: Option<&AnyObject>,
property: &NSSpeechPropertyKey,
) -> Result<(), Retained<NSError>>;
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[unsafe(method(isAnyApplicationSpeaking))]
#[unsafe(method_family = none)]
pub fn isAnyApplicationSpeaking() -> bool;
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[unsafe(method(defaultVoice))]
#[unsafe(method_family = none)]
pub fn defaultVoice() -> Retained<NSSpeechSynthesizerVoiceName>;
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[unsafe(method(availableVoices))]
#[unsafe(method_family = none)]
pub fn availableVoices() -> Retained<NSArray<NSSpeechSynthesizerVoiceName>>;
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[unsafe(method(attributesForVoice:))]
#[unsafe(method_family = none)]
pub fn attributesForVoice(
voice: &NSSpeechSynthesizerVoiceName,
) -> Retained<NSDictionary<NSVoiceAttributeKey, AnyObject>>;
);
}
impl NSSpeechSynthesizer {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSSpeechSynthesizer {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_protocol!(
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub unsafe trait NSSpeechSynthesizerDelegate: NSObjectProtocol + MainThreadOnly {
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[optional]
#[unsafe(method(speechSynthesizer:didFinishSpeaking:))]
#[unsafe(method_family = none)]
fn speechSynthesizer_didFinishSpeaking(
&self,
sender: &NSSpeechSynthesizer,
finished_speaking: bool,
);
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[optional]
#[unsafe(method(speechSynthesizer:willSpeakWord:ofString:))]
#[unsafe(method_family = none)]
fn speechSynthesizer_willSpeakWord_ofString(
&self,
sender: &NSSpeechSynthesizer,
character_range: NSRange,
string: &NSString,
);
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
#[optional]
#[unsafe(method(speechSynthesizer:willSpeakPhoneme:))]
#[unsafe(method_family = none)]
fn speechSynthesizer_willSpeakPhoneme(
&self,
sender: &NSSpeechSynthesizer,
phoneme_opcode: c_short,
);
#[optional]
#[unsafe(method(speechSynthesizer:didEncounterErrorAtIndex:ofString:message:))]
#[unsafe(method_family = none)]
fn speechSynthesizer_didEncounterErrorAtIndex_ofString_message(
&self,
sender: &NSSpeechSynthesizer,
character_index: NSUInteger,
string: &NSString,
message: &NSString,
);
#[optional]
#[unsafe(method(speechSynthesizer:didEncounterSyncMessage:))]
#[unsafe(method_family = none)]
fn speechSynthesizer_didEncounterSyncMessage(
&self,
sender: &NSSpeechSynthesizer,
message: &NSString,
);
}
);
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub type NSSpeechMode = NSString;
extern "C" {
pub static NSSpeechModeText: &'static NSSpeechMode;
}
extern "C" {
pub static NSSpeechModePhoneme: &'static NSSpeechMode;
}
extern "C" {
pub static NSSpeechModeNormal: &'static NSSpeechMode;
}
extern "C" {
pub static NSSpeechModeLiteral: &'static NSSpeechMode;
}
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub type NSSpeechStatusKey = NSString;
extern "C" {
pub static NSSpeechStatusOutputBusy: &'static NSSpeechStatusKey;
}
extern "C" {
pub static NSSpeechStatusOutputPaused: &'static NSSpeechStatusKey;
}
extern "C" {
pub static NSSpeechStatusNumberOfCharactersLeft: &'static NSSpeechStatusKey;
}
extern "C" {
pub static NSSpeechStatusPhonemeCode: &'static NSSpeechStatusKey;
}
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub type NSSpeechErrorKey = NSString;
extern "C" {
pub static NSSpeechErrorCount: &'static NSSpeechErrorKey;
}
extern "C" {
pub static NSSpeechErrorOldestCode: &'static NSSpeechErrorKey;
}
extern "C" {
pub static NSSpeechErrorOldestCharacterOffset: &'static NSSpeechErrorKey;
}
extern "C" {
pub static NSSpeechErrorNewestCode: &'static NSSpeechErrorKey;
}
extern "C" {
pub static NSSpeechErrorNewestCharacterOffset: &'static NSSpeechErrorKey;
}
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub type NSSpeechSynthesizerInfoKey = NSString;
extern "C" {
pub static NSSpeechSynthesizerInfoIdentifier: &'static NSSpeechSynthesizerInfoKey;
}
extern "C" {
pub static NSSpeechSynthesizerInfoVersion: &'static NSSpeechSynthesizerInfoKey;
}
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub type NSSpeechPhonemeInfoKey = NSString;
extern "C" {
pub static NSSpeechPhonemeInfoOpcode: &'static NSSpeechPhonemeInfoKey;
}
extern "C" {
pub static NSSpeechPhonemeInfoSymbol: &'static NSSpeechPhonemeInfoKey;
}
extern "C" {
pub static NSSpeechPhonemeInfoExample: &'static NSSpeechPhonemeInfoKey;
}
extern "C" {
pub static NSSpeechPhonemeInfoHiliteStart: &'static NSSpeechPhonemeInfoKey;
}
extern "C" {
pub static NSSpeechPhonemeInfoHiliteEnd: &'static NSSpeechPhonemeInfoKey;
}
#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
pub type NSSpeechCommandDelimiterKey = NSString;
extern "C" {
pub static NSSpeechCommandPrefix: &'static NSSpeechCommandDelimiterKey;
}
extern "C" {
pub static NSSpeechCommandSuffix: &'static NSSpeechCommandDelimiterKey;
}