objc2_app_kit/generated/
NSSpeechSynthesizer.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
12pub type NSSpeechSynthesizerVoiceName = NSString;
14
15#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
17pub type NSVoiceAttributeKey = NSString;
19
20extern "C" {
21 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
23 pub static NSVoiceName: &'static NSVoiceAttributeKey;
24}
25
26extern "C" {
27 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
29 pub static NSVoiceIdentifier: &'static NSVoiceAttributeKey;
30}
31
32extern "C" {
33 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
35 pub static NSVoiceAge: &'static NSVoiceAttributeKey;
36}
37
38extern "C" {
39 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
41 pub static NSVoiceGender: &'static NSVoiceAttributeKey;
42}
43
44extern "C" {
45 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
47 pub static NSVoiceDemoText: &'static NSVoiceAttributeKey;
48}
49
50extern "C" {
51 pub static NSVoiceLocaleIdentifier: &'static NSVoiceAttributeKey;
53}
54
55extern "C" {
56 pub static NSVoiceSupportedCharacters: &'static NSVoiceAttributeKey;
58}
59
60extern "C" {
61 pub static NSVoiceIndividuallySpokenCharacters: &'static NSVoiceAttributeKey;
63}
64
65#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
67pub type NSSpeechDictionaryKey = NSString;
69
70extern "C" {
71 pub static NSSpeechDictionaryLocaleIdentifier: &'static NSSpeechDictionaryKey;
73}
74
75extern "C" {
76 pub static NSSpeechDictionaryModificationDate: &'static NSSpeechDictionaryKey;
78}
79
80extern "C" {
81 pub static NSSpeechDictionaryPronunciations: &'static NSSpeechDictionaryKey;
83}
84
85extern "C" {
86 pub static NSSpeechDictionaryAbbreviations: &'static NSSpeechDictionaryKey;
88}
89
90extern "C" {
91 pub static NSSpeechDictionaryEntrySpelling: &'static NSSpeechDictionaryKey;
93}
94
95extern "C" {
96 pub static NSSpeechDictionaryEntryPhonemes: &'static NSSpeechDictionaryKey;
98}
99
100#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
102pub type NSVoiceGenderName = NSString;
104
105extern "C" {
106 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
108 pub static NSVoiceGenderNeuter: &'static NSVoiceGenderName;
109}
110
111extern "C" {
112 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
114 pub static NSVoiceGenderMale: &'static NSVoiceGenderName;
115}
116
117extern "C" {
118 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
120 pub static NSVoiceGenderFemale: &'static NSVoiceGenderName;
121}
122
123extern "C" {
124 pub static NSVoiceGenderNeutral: &'static NSVoiceGenderName;
126}
127
128#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
130pub type NSSpeechPropertyKey = NSString;
132
133extern "C" {
134 pub static NSSpeechStatusProperty: &'static NSSpeechPropertyKey;
136}
137
138extern "C" {
139 pub static NSSpeechErrorsProperty: &'static NSSpeechPropertyKey;
141}
142
143extern "C" {
144 pub static NSSpeechInputModeProperty: &'static NSSpeechPropertyKey;
146}
147
148extern "C" {
149 pub static NSSpeechCharacterModeProperty: &'static NSSpeechPropertyKey;
151}
152
153extern "C" {
154 pub static NSSpeechNumberModeProperty: &'static NSSpeechPropertyKey;
156}
157
158extern "C" {
159 pub static NSSpeechRateProperty: &'static NSSpeechPropertyKey;
161}
162
163extern "C" {
164 pub static NSSpeechPitchBaseProperty: &'static NSSpeechPropertyKey;
166}
167
168extern "C" {
169 pub static NSSpeechPitchModProperty: &'static NSSpeechPropertyKey;
171}
172
173extern "C" {
174 pub static NSSpeechVolumeProperty: &'static NSSpeechPropertyKey;
176}
177
178extern "C" {
179 pub static NSSpeechSynthesizerInfoProperty: &'static NSSpeechPropertyKey;
181}
182
183extern "C" {
184 pub static NSSpeechRecentSyncProperty: &'static NSSpeechPropertyKey;
186}
187
188extern "C" {
189 pub static NSSpeechPhonemeSymbolsProperty: &'static NSSpeechPropertyKey;
191}
192
193extern "C" {
194 pub static NSSpeechCurrentVoiceProperty: &'static NSSpeechPropertyKey;
196}
197
198extern "C" {
199 pub static NSSpeechCommandDelimiterProperty: &'static NSSpeechPropertyKey;
201}
202
203extern "C" {
204 pub static NSSpeechResetProperty: &'static NSSpeechPropertyKey;
206}
207
208extern "C" {
209 pub static NSSpeechOutputToFileURLProperty: &'static NSSpeechPropertyKey;
211}
212
213extern "C" {
214 #[deprecated]
216 pub static NSVoiceLanguage: &'static NSVoiceAttributeKey;
217}
218
219#[repr(transparent)]
222#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
223pub struct NSSpeechBoundary(pub NSUInteger);
224impl NSSpeechBoundary {
225 #[doc(alias = "NSSpeechImmediateBoundary")]
226 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
227 pub const ImmediateBoundary: Self = Self(0);
228 #[doc(alias = "NSSpeechWordBoundary")]
229 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
230 pub const WordBoundary: Self = Self(1);
231 #[doc(alias = "NSSpeechSentenceBoundary")]
232 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
233 pub const SentenceBoundary: Self = Self(2);
234}
235
236unsafe impl Encode for NSSpeechBoundary {
237 const ENCODING: Encoding = NSUInteger::ENCODING;
238}
239
240unsafe impl RefEncode for NSSpeechBoundary {
241 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
242}
243
244extern_class!(
245 #[unsafe(super(NSObject))]
247 #[derive(Debug, PartialEq, Eq, Hash)]
248 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
249 pub struct NSSpeechSynthesizer;
250);
251
252extern_conformance!(
253 unsafe impl NSObjectProtocol for NSSpeechSynthesizer {}
254);
255
256impl NSSpeechSynthesizer {
257 extern_methods!(
258 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
259 #[unsafe(method(initWithVoice:))]
260 #[unsafe(method_family = init)]
261 pub fn initWithVoice(
262 this: Allocated<Self>,
263 voice: Option<&NSSpeechSynthesizerVoiceName>,
264 ) -> Option<Retained<Self>>;
265
266 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
267 #[unsafe(method(startSpeakingString:))]
268 #[unsafe(method_family = none)]
269 pub fn startSpeakingString(&self, string: &NSString) -> bool;
270
271 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
272 #[unsafe(method(startSpeakingString:toURL:))]
273 #[unsafe(method_family = none)]
274 pub fn startSpeakingString_toURL(&self, string: &NSString, url: &NSURL) -> bool;
275
276 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
277 #[unsafe(method(isSpeaking))]
278 #[unsafe(method_family = none)]
279 pub fn isSpeaking(&self) -> bool;
280
281 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
282 #[unsafe(method(stopSpeaking))]
283 #[unsafe(method_family = none)]
284 pub fn stopSpeaking(&self);
285
286 #[unsafe(method(stopSpeakingAtBoundary:))]
287 #[unsafe(method_family = none)]
288 pub fn stopSpeakingAtBoundary(&self, boundary: NSSpeechBoundary);
289
290 #[unsafe(method(pauseSpeakingAtBoundary:))]
291 #[unsafe(method_family = none)]
292 pub fn pauseSpeakingAtBoundary(&self, boundary: NSSpeechBoundary);
293
294 #[unsafe(method(continueSpeaking))]
295 #[unsafe(method_family = none)]
296 pub fn continueSpeaking(&self);
297
298 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
299 #[unsafe(method(delegate))]
300 #[unsafe(method_family = none)]
301 pub fn delegate(
302 &self,
303 mtm: MainThreadMarker,
304 ) -> Option<Retained<ProtocolObject<dyn NSSpeechSynthesizerDelegate>>>;
305
306 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
310 #[unsafe(method(setDelegate:))]
311 #[unsafe(method_family = none)]
312 pub fn setDelegate(
313 &self,
314 delegate: Option<&ProtocolObject<dyn NSSpeechSynthesizerDelegate>>,
315 );
316
317 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
318 #[unsafe(method(voice))]
319 #[unsafe(method_family = none)]
320 pub fn voice(&self) -> Option<Retained<NSSpeechSynthesizerVoiceName>>;
321
322 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
323 #[unsafe(method(setVoice:))]
324 #[unsafe(method_family = none)]
325 pub fn setVoice(&self, voice: Option<&NSSpeechSynthesizerVoiceName>) -> bool;
326
327 #[unsafe(method(rate))]
328 #[unsafe(method_family = none)]
329 pub fn rate(&self) -> c_float;
330
331 #[unsafe(method(setRate:))]
333 #[unsafe(method_family = none)]
334 pub fn setRate(&self, rate: c_float);
335
336 #[unsafe(method(volume))]
337 #[unsafe(method_family = none)]
338 pub fn volume(&self) -> c_float;
339
340 #[unsafe(method(setVolume:))]
342 #[unsafe(method_family = none)]
343 pub fn setVolume(&self, volume: c_float);
344
345 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
346 #[unsafe(method(usesFeedbackWindow))]
347 #[unsafe(method_family = none)]
348 pub fn usesFeedbackWindow(&self) -> bool;
349
350 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
352 #[unsafe(method(setUsesFeedbackWindow:))]
353 #[unsafe(method_family = none)]
354 pub fn setUsesFeedbackWindow(&self, uses_feedback_window: bool);
355
356 #[unsafe(method(addSpeechDictionary:))]
360 #[unsafe(method_family = none)]
361 pub unsafe fn addSpeechDictionary(
362 &self,
363 speech_dictionary: &NSDictionary<NSSpeechDictionaryKey, AnyObject>,
364 );
365
366 #[unsafe(method(phonemesFromText:))]
367 #[unsafe(method_family = none)]
368 pub fn phonemesFromText(&self, text: &NSString) -> Retained<NSString>;
369
370 #[unsafe(method(objectForProperty:error:_))]
371 #[unsafe(method_family = none)]
372 pub fn objectForProperty_error(
373 &self,
374 property: &NSSpeechPropertyKey,
375 ) -> Result<Retained<AnyObject>, Retained<NSError>>;
376
377 #[unsafe(method(setObject:forProperty:error:_))]
381 #[unsafe(method_family = none)]
382 pub unsafe fn setObject_forProperty_error(
383 &self,
384 object: Option<&AnyObject>,
385 property: &NSSpeechPropertyKey,
386 ) -> Result<(), Retained<NSError>>;
387
388 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
389 #[unsafe(method(isAnyApplicationSpeaking))]
390 #[unsafe(method_family = none)]
391 pub fn isAnyApplicationSpeaking() -> bool;
392
393 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
394 #[unsafe(method(defaultVoice))]
395 #[unsafe(method_family = none)]
396 pub fn defaultVoice() -> Retained<NSSpeechSynthesizerVoiceName>;
397
398 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
399 #[unsafe(method(availableVoices))]
400 #[unsafe(method_family = none)]
401 pub fn availableVoices() -> Retained<NSArray<NSSpeechSynthesizerVoiceName>>;
402
403 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
404 #[unsafe(method(attributesForVoice:))]
405 #[unsafe(method_family = none)]
406 pub fn attributesForVoice(
407 voice: &NSSpeechSynthesizerVoiceName,
408 ) -> Retained<NSDictionary<NSVoiceAttributeKey, AnyObject>>;
409 );
410}
411
412impl NSSpeechSynthesizer {
414 extern_methods!(
415 #[unsafe(method(init))]
416 #[unsafe(method_family = init)]
417 pub fn init(this: Allocated<Self>) -> Retained<Self>;
418
419 #[unsafe(method(new))]
420 #[unsafe(method_family = new)]
421 pub fn new() -> Retained<Self>;
422 );
423}
424
425impl DefaultRetained for NSSpeechSynthesizer {
426 #[inline]
427 fn default_retained() -> Retained<Self> {
428 Self::new()
429 }
430}
431
432extern_protocol!(
433 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
435 pub unsafe trait NSSpeechSynthesizerDelegate: NSObjectProtocol + MainThreadOnly {
436 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
437 #[optional]
438 #[unsafe(method(speechSynthesizer:didFinishSpeaking:))]
439 #[unsafe(method_family = none)]
440 fn speechSynthesizer_didFinishSpeaking(
441 &self,
442 sender: &NSSpeechSynthesizer,
443 finished_speaking: bool,
444 );
445
446 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
447 #[optional]
448 #[unsafe(method(speechSynthesizer:willSpeakWord:ofString:))]
449 #[unsafe(method_family = none)]
450 fn speechSynthesizer_willSpeakWord_ofString(
451 &self,
452 sender: &NSSpeechSynthesizer,
453 character_range: NSRange,
454 string: &NSString,
455 );
456
457 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
458 #[optional]
459 #[unsafe(method(speechSynthesizer:willSpeakPhoneme:))]
460 #[unsafe(method_family = none)]
461 fn speechSynthesizer_willSpeakPhoneme(
462 &self,
463 sender: &NSSpeechSynthesizer,
464 phoneme_opcode: c_short,
465 );
466
467 #[optional]
468 #[unsafe(method(speechSynthesizer:didEncounterErrorAtIndex:ofString:message:))]
469 #[unsafe(method_family = none)]
470 fn speechSynthesizer_didEncounterErrorAtIndex_ofString_message(
471 &self,
472 sender: &NSSpeechSynthesizer,
473 character_index: NSUInteger,
474 string: &NSString,
475 message: &NSString,
476 );
477
478 #[optional]
479 #[unsafe(method(speechSynthesizer:didEncounterSyncMessage:))]
480 #[unsafe(method_family = none)]
481 fn speechSynthesizer_didEncounterSyncMessage(
482 &self,
483 sender: &NSSpeechSynthesizer,
484 message: &NSString,
485 );
486 }
487);
488
489#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
491pub type NSSpeechMode = NSString;
493
494extern "C" {
495 pub static NSSpeechModeText: &'static NSSpeechMode;
497}
498
499extern "C" {
500 pub static NSSpeechModePhoneme: &'static NSSpeechMode;
502}
503
504extern "C" {
505 pub static NSSpeechModeNormal: &'static NSSpeechMode;
507}
508
509extern "C" {
510 pub static NSSpeechModeLiteral: &'static NSSpeechMode;
512}
513
514#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
516pub type NSSpeechStatusKey = NSString;
518
519extern "C" {
520 pub static NSSpeechStatusOutputBusy: &'static NSSpeechStatusKey;
522}
523
524extern "C" {
525 pub static NSSpeechStatusOutputPaused: &'static NSSpeechStatusKey;
527}
528
529extern "C" {
530 pub static NSSpeechStatusNumberOfCharactersLeft: &'static NSSpeechStatusKey;
532}
533
534extern "C" {
535 pub static NSSpeechStatusPhonemeCode: &'static NSSpeechStatusKey;
537}
538
539#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
541pub type NSSpeechErrorKey = NSString;
543
544extern "C" {
545 pub static NSSpeechErrorCount: &'static NSSpeechErrorKey;
547}
548
549extern "C" {
550 pub static NSSpeechErrorOldestCode: &'static NSSpeechErrorKey;
552}
553
554extern "C" {
555 pub static NSSpeechErrorOldestCharacterOffset: &'static NSSpeechErrorKey;
557}
558
559extern "C" {
560 pub static NSSpeechErrorNewestCode: &'static NSSpeechErrorKey;
562}
563
564extern "C" {
565 pub static NSSpeechErrorNewestCharacterOffset: &'static NSSpeechErrorKey;
567}
568
569#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
571pub type NSSpeechSynthesizerInfoKey = NSString;
573
574extern "C" {
575 pub static NSSpeechSynthesizerInfoIdentifier: &'static NSSpeechSynthesizerInfoKey;
577}
578
579extern "C" {
580 pub static NSSpeechSynthesizerInfoVersion: &'static NSSpeechSynthesizerInfoKey;
582}
583
584#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
586pub type NSSpeechPhonemeInfoKey = NSString;
588
589extern "C" {
590 pub static NSSpeechPhonemeInfoOpcode: &'static NSSpeechPhonemeInfoKey;
592}
593
594extern "C" {
595 pub static NSSpeechPhonemeInfoSymbol: &'static NSSpeechPhonemeInfoKey;
597}
598
599extern "C" {
600 pub static NSSpeechPhonemeInfoExample: &'static NSSpeechPhonemeInfoKey;
602}
603
604extern "C" {
605 pub static NSSpeechPhonemeInfoHiliteStart: &'static NSSpeechPhonemeInfoKey;
607}
608
609extern "C" {
610 pub static NSSpeechPhonemeInfoHiliteEnd: &'static NSSpeechPhonemeInfoKey;
612}
613
614#[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
616pub type NSSpeechCommandDelimiterKey = NSString;
618
619extern "C" {
620 pub static NSSpeechCommandPrefix: &'static NSSpeechCommandDelimiterKey;
622}
623
624extern "C" {
625 pub static NSSpeechCommandSuffix: &'static NSSpeechCommandDelimiterKey;
627}