objc2_app_kit/generated/
NSSpeechSynthesizer.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10pub type NSSpeechSynthesizerVoiceName = NSString;
13
14pub type NSVoiceAttributeKey = NSString;
17
18extern "C" {
19 pub static NSVoiceName: &'static NSVoiceAttributeKey;
21}
22
23extern "C" {
24 pub static NSVoiceIdentifier: &'static NSVoiceAttributeKey;
26}
27
28extern "C" {
29 pub static NSVoiceAge: &'static NSVoiceAttributeKey;
31}
32
33extern "C" {
34 pub static NSVoiceGender: &'static NSVoiceAttributeKey;
36}
37
38extern "C" {
39 pub static NSVoiceDemoText: &'static NSVoiceAttributeKey;
41}
42
43extern "C" {
44 pub static NSVoiceLocaleIdentifier: &'static NSVoiceAttributeKey;
46}
47
48extern "C" {
49 pub static NSVoiceSupportedCharacters: &'static NSVoiceAttributeKey;
51}
52
53extern "C" {
54 pub static NSVoiceIndividuallySpokenCharacters: &'static NSVoiceAttributeKey;
56}
57
58pub type NSSpeechDictionaryKey = NSString;
61
62extern "C" {
63 pub static NSSpeechDictionaryLocaleIdentifier: &'static NSSpeechDictionaryKey;
65}
66
67extern "C" {
68 pub static NSSpeechDictionaryModificationDate: &'static NSSpeechDictionaryKey;
70}
71
72extern "C" {
73 pub static NSSpeechDictionaryPronunciations: &'static NSSpeechDictionaryKey;
75}
76
77extern "C" {
78 pub static NSSpeechDictionaryAbbreviations: &'static NSSpeechDictionaryKey;
80}
81
82extern "C" {
83 pub static NSSpeechDictionaryEntrySpelling: &'static NSSpeechDictionaryKey;
85}
86
87extern "C" {
88 pub static NSSpeechDictionaryEntryPhonemes: &'static NSSpeechDictionaryKey;
90}
91
92pub type NSVoiceGenderName = NSString;
95
96extern "C" {
97 pub static NSVoiceGenderNeuter: &'static NSVoiceGenderName;
99}
100
101extern "C" {
102 pub static NSVoiceGenderMale: &'static NSVoiceGenderName;
104}
105
106extern "C" {
107 pub static NSVoiceGenderFemale: &'static NSVoiceGenderName;
109}
110
111extern "C" {
112 pub static NSVoiceGenderNeutral: &'static NSVoiceGenderName;
114}
115
116pub type NSSpeechPropertyKey = NSString;
119
120extern "C" {
121 pub static NSSpeechStatusProperty: &'static NSSpeechPropertyKey;
123}
124
125extern "C" {
126 pub static NSSpeechErrorsProperty: &'static NSSpeechPropertyKey;
128}
129
130extern "C" {
131 pub static NSSpeechInputModeProperty: &'static NSSpeechPropertyKey;
133}
134
135extern "C" {
136 pub static NSSpeechCharacterModeProperty: &'static NSSpeechPropertyKey;
138}
139
140extern "C" {
141 pub static NSSpeechNumberModeProperty: &'static NSSpeechPropertyKey;
143}
144
145extern "C" {
146 pub static NSSpeechRateProperty: &'static NSSpeechPropertyKey;
148}
149
150extern "C" {
151 pub static NSSpeechPitchBaseProperty: &'static NSSpeechPropertyKey;
153}
154
155extern "C" {
156 pub static NSSpeechPitchModProperty: &'static NSSpeechPropertyKey;
158}
159
160extern "C" {
161 pub static NSSpeechVolumeProperty: &'static NSSpeechPropertyKey;
163}
164
165extern "C" {
166 pub static NSSpeechSynthesizerInfoProperty: &'static NSSpeechPropertyKey;
168}
169
170extern "C" {
171 pub static NSSpeechRecentSyncProperty: &'static NSSpeechPropertyKey;
173}
174
175extern "C" {
176 pub static NSSpeechPhonemeSymbolsProperty: &'static NSSpeechPropertyKey;
178}
179
180extern "C" {
181 pub static NSSpeechCurrentVoiceProperty: &'static NSSpeechPropertyKey;
183}
184
185extern "C" {
186 pub static NSSpeechCommandDelimiterProperty: &'static NSSpeechPropertyKey;
188}
189
190extern "C" {
191 pub static NSSpeechResetProperty: &'static NSSpeechPropertyKey;
193}
194
195extern "C" {
196 pub static NSSpeechOutputToFileURLProperty: &'static NSSpeechPropertyKey;
198}
199
200extern "C" {
201 pub static NSVoiceLanguage: &'static NSVoiceAttributeKey;
203}
204
205#[repr(transparent)]
208#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
209pub struct NSSpeechBoundary(pub NSUInteger);
210impl NSSpeechBoundary {
211 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
212 #[doc(alias = "NSSpeechImmediateBoundary")]
213 pub const ImmediateBoundary: Self = Self(0);
214 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
215 #[doc(alias = "NSSpeechWordBoundary")]
216 pub const WordBoundary: Self = Self(1);
217 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
218 #[doc(alias = "NSSpeechSentenceBoundary")]
219 pub const SentenceBoundary: Self = Self(2);
220}
221
222unsafe impl Encode for NSSpeechBoundary {
223 const ENCODING: Encoding = NSUInteger::ENCODING;
224}
225
226unsafe impl RefEncode for NSSpeechBoundary {
227 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
228}
229
230extern_class!(
231 #[unsafe(super(NSObject))]
233 #[derive(Debug, PartialEq, Eq, Hash)]
234 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
235 pub struct NSSpeechSynthesizer;
236);
237
238unsafe impl NSObjectProtocol for NSSpeechSynthesizer {}
239
240impl NSSpeechSynthesizer {
241 extern_methods!(
242 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
243 #[unsafe(method(initWithVoice:))]
244 #[unsafe(method_family = init)]
245 pub unsafe fn initWithVoice(
246 this: Allocated<Self>,
247 voice: Option<&NSSpeechSynthesizerVoiceName>,
248 ) -> Option<Retained<Self>>;
249
250 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
251 #[unsafe(method(startSpeakingString:))]
252 #[unsafe(method_family = none)]
253 pub unsafe fn startSpeakingString(&self, string: &NSString) -> bool;
254
255 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
256 #[unsafe(method(startSpeakingString:toURL:))]
257 #[unsafe(method_family = none)]
258 pub unsafe fn startSpeakingString_toURL(&self, string: &NSString, url: &NSURL) -> bool;
259
260 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
261 #[unsafe(method(isSpeaking))]
262 #[unsafe(method_family = none)]
263 pub unsafe fn isSpeaking(&self) -> bool;
264
265 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
266 #[unsafe(method(stopSpeaking))]
267 #[unsafe(method_family = none)]
268 pub unsafe fn stopSpeaking(&self);
269
270 #[unsafe(method(stopSpeakingAtBoundary:))]
271 #[unsafe(method_family = none)]
272 pub unsafe fn stopSpeakingAtBoundary(&self, boundary: NSSpeechBoundary);
273
274 #[unsafe(method(pauseSpeakingAtBoundary:))]
275 #[unsafe(method_family = none)]
276 pub unsafe fn pauseSpeakingAtBoundary(&self, boundary: NSSpeechBoundary);
277
278 #[unsafe(method(continueSpeaking))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn continueSpeaking(&self);
281
282 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
283 #[unsafe(method(delegate))]
284 #[unsafe(method_family = none)]
285 pub unsafe fn delegate(
286 &self,
287 mtm: MainThreadMarker,
288 ) -> Option<Retained<ProtocolObject<dyn NSSpeechSynthesizerDelegate>>>;
289
290 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
293 #[unsafe(method(setDelegate:))]
294 #[unsafe(method_family = none)]
295 pub unsafe fn setDelegate(
296 &self,
297 delegate: Option<&ProtocolObject<dyn NSSpeechSynthesizerDelegate>>,
298 );
299
300 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
301 #[unsafe(method(voice))]
302 #[unsafe(method_family = none)]
303 pub unsafe fn voice(&self) -> Option<Retained<NSSpeechSynthesizerVoiceName>>;
304
305 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
306 #[unsafe(method(setVoice:))]
307 #[unsafe(method_family = none)]
308 pub unsafe fn setVoice(&self, voice: Option<&NSSpeechSynthesizerVoiceName>) -> bool;
309
310 #[unsafe(method(rate))]
311 #[unsafe(method_family = none)]
312 pub unsafe fn rate(&self) -> c_float;
313
314 #[unsafe(method(setRate:))]
316 #[unsafe(method_family = none)]
317 pub unsafe fn setRate(&self, rate: c_float);
318
319 #[unsafe(method(volume))]
320 #[unsafe(method_family = none)]
321 pub unsafe fn volume(&self) -> c_float;
322
323 #[unsafe(method(setVolume:))]
325 #[unsafe(method_family = none)]
326 pub unsafe fn setVolume(&self, volume: c_float);
327
328 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
329 #[unsafe(method(usesFeedbackWindow))]
330 #[unsafe(method_family = none)]
331 pub unsafe fn usesFeedbackWindow(&self) -> bool;
332
333 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
335 #[unsafe(method(setUsesFeedbackWindow:))]
336 #[unsafe(method_family = none)]
337 pub unsafe fn setUsesFeedbackWindow(&self, uses_feedback_window: bool);
338
339 #[unsafe(method(addSpeechDictionary:))]
340 #[unsafe(method_family = none)]
341 pub unsafe fn addSpeechDictionary(
342 &self,
343 speech_dictionary: &NSDictionary<NSSpeechDictionaryKey, AnyObject>,
344 );
345
346 #[unsafe(method(phonemesFromText:))]
347 #[unsafe(method_family = none)]
348 pub unsafe fn phonemesFromText(&self, text: &NSString) -> Retained<NSString>;
349
350 #[unsafe(method(objectForProperty:error:_))]
351 #[unsafe(method_family = none)]
352 pub unsafe fn objectForProperty_error(
353 &self,
354 property: &NSSpeechPropertyKey,
355 ) -> Result<Retained<AnyObject>, Retained<NSError>>;
356
357 #[unsafe(method(setObject:forProperty:error:_))]
358 #[unsafe(method_family = none)]
359 pub unsafe fn setObject_forProperty_error(
360 &self,
361 object: Option<&AnyObject>,
362 property: &NSSpeechPropertyKey,
363 ) -> Result<(), Retained<NSError>>;
364
365 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
366 #[unsafe(method(isAnyApplicationSpeaking))]
367 #[unsafe(method_family = none)]
368 pub unsafe fn isAnyApplicationSpeaking() -> bool;
369
370 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
371 #[unsafe(method(defaultVoice))]
372 #[unsafe(method_family = none)]
373 pub unsafe fn defaultVoice() -> Retained<NSSpeechSynthesizerVoiceName>;
374
375 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
376 #[unsafe(method(availableVoices))]
377 #[unsafe(method_family = none)]
378 pub unsafe fn availableVoices() -> Retained<NSArray<NSSpeechSynthesizerVoiceName>>;
379
380 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
381 #[unsafe(method(attributesForVoice:))]
382 #[unsafe(method_family = none)]
383 pub unsafe fn attributesForVoice(
384 voice: &NSSpeechSynthesizerVoiceName,
385 ) -> Retained<NSDictionary<NSVoiceAttributeKey, AnyObject>>;
386 );
387}
388
389impl NSSpeechSynthesizer {
391 extern_methods!(
392 #[unsafe(method(init))]
393 #[unsafe(method_family = init)]
394 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
395
396 #[unsafe(method(new))]
397 #[unsafe(method_family = new)]
398 pub unsafe fn new() -> Retained<Self>;
399 );
400}
401
402extern_protocol!(
403 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
405 pub unsafe trait NSSpeechSynthesizerDelegate: NSObjectProtocol + MainThreadOnly {
406 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
407 #[optional]
408 #[unsafe(method(speechSynthesizer:didFinishSpeaking:))]
409 #[unsafe(method_family = none)]
410 unsafe fn speechSynthesizer_didFinishSpeaking(
411 &self,
412 sender: &NSSpeechSynthesizer,
413 finished_speaking: bool,
414 );
415
416 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
417 #[optional]
418 #[unsafe(method(speechSynthesizer:willSpeakWord:ofString:))]
419 #[unsafe(method_family = none)]
420 unsafe fn speechSynthesizer_willSpeakWord_ofString(
421 &self,
422 sender: &NSSpeechSynthesizer,
423 character_range: NSRange,
424 string: &NSString,
425 );
426
427 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
428 #[optional]
429 #[unsafe(method(speechSynthesizer:willSpeakPhoneme:))]
430 #[unsafe(method_family = none)]
431 unsafe fn speechSynthesizer_willSpeakPhoneme(
432 &self,
433 sender: &NSSpeechSynthesizer,
434 phoneme_opcode: c_short,
435 );
436
437 #[optional]
438 #[unsafe(method(speechSynthesizer:didEncounterErrorAtIndex:ofString:message:))]
439 #[unsafe(method_family = none)]
440 unsafe fn speechSynthesizer_didEncounterErrorAtIndex_ofString_message(
441 &self,
442 sender: &NSSpeechSynthesizer,
443 character_index: NSUInteger,
444 string: &NSString,
445 message: &NSString,
446 );
447
448 #[optional]
449 #[unsafe(method(speechSynthesizer:didEncounterSyncMessage:))]
450 #[unsafe(method_family = none)]
451 unsafe fn speechSynthesizer_didEncounterSyncMessage(
452 &self,
453 sender: &NSSpeechSynthesizer,
454 message: &NSString,
455 );
456 }
457);
458
459pub type NSSpeechMode = NSString;
462
463extern "C" {
464 pub static NSSpeechModeText: &'static NSSpeechMode;
466}
467
468extern "C" {
469 pub static NSSpeechModePhoneme: &'static NSSpeechMode;
471}
472
473extern "C" {
474 pub static NSSpeechModeNormal: &'static NSSpeechMode;
476}
477
478extern "C" {
479 pub static NSSpeechModeLiteral: &'static NSSpeechMode;
481}
482
483pub type NSSpeechStatusKey = NSString;
486
487extern "C" {
488 pub static NSSpeechStatusOutputBusy: &'static NSSpeechStatusKey;
490}
491
492extern "C" {
493 pub static NSSpeechStatusOutputPaused: &'static NSSpeechStatusKey;
495}
496
497extern "C" {
498 pub static NSSpeechStatusNumberOfCharactersLeft: &'static NSSpeechStatusKey;
500}
501
502extern "C" {
503 pub static NSSpeechStatusPhonemeCode: &'static NSSpeechStatusKey;
505}
506
507pub type NSSpeechErrorKey = NSString;
510
511extern "C" {
512 pub static NSSpeechErrorCount: &'static NSSpeechErrorKey;
514}
515
516extern "C" {
517 pub static NSSpeechErrorOldestCode: &'static NSSpeechErrorKey;
519}
520
521extern "C" {
522 pub static NSSpeechErrorOldestCharacterOffset: &'static NSSpeechErrorKey;
524}
525
526extern "C" {
527 pub static NSSpeechErrorNewestCode: &'static NSSpeechErrorKey;
529}
530
531extern "C" {
532 pub static NSSpeechErrorNewestCharacterOffset: &'static NSSpeechErrorKey;
534}
535
536pub type NSSpeechSynthesizerInfoKey = NSString;
539
540extern "C" {
541 pub static NSSpeechSynthesizerInfoIdentifier: &'static NSSpeechSynthesizerInfoKey;
543}
544
545extern "C" {
546 pub static NSSpeechSynthesizerInfoVersion: &'static NSSpeechSynthesizerInfoKey;
548}
549
550pub type NSSpeechPhonemeInfoKey = NSString;
553
554extern "C" {
555 pub static NSSpeechPhonemeInfoOpcode: &'static NSSpeechPhonemeInfoKey;
557}
558
559extern "C" {
560 pub static NSSpeechPhonemeInfoSymbol: &'static NSSpeechPhonemeInfoKey;
562}
563
564extern "C" {
565 pub static NSSpeechPhonemeInfoExample: &'static NSSpeechPhonemeInfoKey;
567}
568
569extern "C" {
570 pub static NSSpeechPhonemeInfoHiliteStart: &'static NSSpeechPhonemeInfoKey;
572}
573
574extern "C" {
575 pub static NSSpeechPhonemeInfoHiliteEnd: &'static NSSpeechPhonemeInfoKey;
577}
578
579pub type NSSpeechCommandDelimiterKey = NSString;
582
583extern "C" {
584 pub static NSSpeechCommandPrefix: &'static NSSpeechCommandDelimiterKey;
586}
587
588extern "C" {
589 pub static NSSpeechCommandSuffix: &'static NSSpeechCommandDelimiterKey;
591}