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 #[doc(alias = "NSSpeechImmediateBoundary")]
212 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
213 pub const ImmediateBoundary: Self = Self(0);
214 #[doc(alias = "NSSpeechWordBoundary")]
215 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
216 pub const WordBoundary: Self = Self(1);
217 #[doc(alias = "NSSpeechSentenceBoundary")]
218 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
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
238extern_conformance!(
239 unsafe impl NSObjectProtocol for NSSpeechSynthesizer {}
240);
241
242impl NSSpeechSynthesizer {
243 extern_methods!(
244 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
245 #[unsafe(method(initWithVoice:))]
246 #[unsafe(method_family = init)]
247 pub unsafe fn initWithVoice(
248 this: Allocated<Self>,
249 voice: Option<&NSSpeechSynthesizerVoiceName>,
250 ) -> Option<Retained<Self>>;
251
252 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
253 #[unsafe(method(startSpeakingString:))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn startSpeakingString(&self, string: &NSString) -> bool;
256
257 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
258 #[unsafe(method(startSpeakingString:toURL:))]
259 #[unsafe(method_family = none)]
260 pub unsafe fn startSpeakingString_toURL(&self, string: &NSString, url: &NSURL) -> bool;
261
262 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
263 #[unsafe(method(isSpeaking))]
264 #[unsafe(method_family = none)]
265 pub unsafe fn isSpeaking(&self) -> bool;
266
267 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
268 #[unsafe(method(stopSpeaking))]
269 #[unsafe(method_family = none)]
270 pub unsafe fn stopSpeaking(&self);
271
272 #[unsafe(method(stopSpeakingAtBoundary:))]
273 #[unsafe(method_family = none)]
274 pub unsafe fn stopSpeakingAtBoundary(&self, boundary: NSSpeechBoundary);
275
276 #[unsafe(method(pauseSpeakingAtBoundary:))]
277 #[unsafe(method_family = none)]
278 pub unsafe fn pauseSpeakingAtBoundary(&self, boundary: NSSpeechBoundary);
279
280 #[unsafe(method(continueSpeaking))]
281 #[unsafe(method_family = none)]
282 pub unsafe fn continueSpeaking(&self);
283
284 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
285 #[unsafe(method(delegate))]
286 #[unsafe(method_family = none)]
287 pub unsafe fn delegate(
288 &self,
289 mtm: MainThreadMarker,
290 ) -> Option<Retained<ProtocolObject<dyn NSSpeechSynthesizerDelegate>>>;
291
292 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
295 #[unsafe(method(setDelegate:))]
296 #[unsafe(method_family = none)]
297 pub unsafe fn setDelegate(
298 &self,
299 delegate: Option<&ProtocolObject<dyn NSSpeechSynthesizerDelegate>>,
300 );
301
302 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
303 #[unsafe(method(voice))]
304 #[unsafe(method_family = none)]
305 pub unsafe fn voice(&self) -> Option<Retained<NSSpeechSynthesizerVoiceName>>;
306
307 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
308 #[unsafe(method(setVoice:))]
309 #[unsafe(method_family = none)]
310 pub unsafe fn setVoice(&self, voice: Option<&NSSpeechSynthesizerVoiceName>) -> bool;
311
312 #[unsafe(method(rate))]
313 #[unsafe(method_family = none)]
314 pub unsafe fn rate(&self) -> c_float;
315
316 #[unsafe(method(setRate:))]
318 #[unsafe(method_family = none)]
319 pub unsafe fn setRate(&self, rate: c_float);
320
321 #[unsafe(method(volume))]
322 #[unsafe(method_family = none)]
323 pub unsafe fn volume(&self) -> c_float;
324
325 #[unsafe(method(setVolume:))]
327 #[unsafe(method_family = none)]
328 pub unsafe fn setVolume(&self, volume: c_float);
329
330 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
331 #[unsafe(method(usesFeedbackWindow))]
332 #[unsafe(method_family = none)]
333 pub unsafe fn usesFeedbackWindow(&self) -> bool;
334
335 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
337 #[unsafe(method(setUsesFeedbackWindow:))]
338 #[unsafe(method_family = none)]
339 pub unsafe fn setUsesFeedbackWindow(&self, uses_feedback_window: bool);
340
341 #[unsafe(method(addSpeechDictionary:))]
342 #[unsafe(method_family = none)]
343 pub unsafe fn addSpeechDictionary(
344 &self,
345 speech_dictionary: &NSDictionary<NSSpeechDictionaryKey, AnyObject>,
346 );
347
348 #[unsafe(method(phonemesFromText:))]
349 #[unsafe(method_family = none)]
350 pub unsafe fn phonemesFromText(&self, text: &NSString) -> Retained<NSString>;
351
352 #[unsafe(method(objectForProperty:error:_))]
353 #[unsafe(method_family = none)]
354 pub unsafe fn objectForProperty_error(
355 &self,
356 property: &NSSpeechPropertyKey,
357 ) -> Result<Retained<AnyObject>, Retained<NSError>>;
358
359 #[unsafe(method(setObject:forProperty:error:_))]
360 #[unsafe(method_family = none)]
361 pub unsafe fn setObject_forProperty_error(
362 &self,
363 object: Option<&AnyObject>,
364 property: &NSSpeechPropertyKey,
365 ) -> Result<(), Retained<NSError>>;
366
367 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
368 #[unsafe(method(isAnyApplicationSpeaking))]
369 #[unsafe(method_family = none)]
370 pub unsafe fn isAnyApplicationSpeaking() -> bool;
371
372 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
373 #[unsafe(method(defaultVoice))]
374 #[unsafe(method_family = none)]
375 pub unsafe fn defaultVoice() -> Retained<NSSpeechSynthesizerVoiceName>;
376
377 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
378 #[unsafe(method(availableVoices))]
379 #[unsafe(method_family = none)]
380 pub unsafe fn availableVoices() -> Retained<NSArray<NSSpeechSynthesizerVoiceName>>;
381
382 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
383 #[unsafe(method(attributesForVoice:))]
384 #[unsafe(method_family = none)]
385 pub unsafe fn attributesForVoice(
386 voice: &NSSpeechSynthesizerVoiceName,
387 ) -> Retained<NSDictionary<NSVoiceAttributeKey, AnyObject>>;
388 );
389}
390
391impl NSSpeechSynthesizer {
393 extern_methods!(
394 #[unsafe(method(init))]
395 #[unsafe(method_family = init)]
396 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
397
398 #[unsafe(method(new))]
399 #[unsafe(method_family = new)]
400 pub unsafe fn new() -> Retained<Self>;
401 );
402}
403
404extern_protocol!(
405 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
407 pub unsafe trait NSSpeechSynthesizerDelegate: NSObjectProtocol + MainThreadOnly {
408 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
409 #[optional]
410 #[unsafe(method(speechSynthesizer:didFinishSpeaking:))]
411 #[unsafe(method_family = none)]
412 unsafe fn speechSynthesizer_didFinishSpeaking(
413 &self,
414 sender: &NSSpeechSynthesizer,
415 finished_speaking: bool,
416 );
417
418 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
419 #[optional]
420 #[unsafe(method(speechSynthesizer:willSpeakWord:ofString:))]
421 #[unsafe(method_family = none)]
422 unsafe fn speechSynthesizer_willSpeakWord_ofString(
423 &self,
424 sender: &NSSpeechSynthesizer,
425 character_range: NSRange,
426 string: &NSString,
427 );
428
429 #[deprecated = "Use AVSpeechSynthesizer in AVFoundation instead"]
430 #[optional]
431 #[unsafe(method(speechSynthesizer:willSpeakPhoneme:))]
432 #[unsafe(method_family = none)]
433 unsafe fn speechSynthesizer_willSpeakPhoneme(
434 &self,
435 sender: &NSSpeechSynthesizer,
436 phoneme_opcode: c_short,
437 );
438
439 #[optional]
440 #[unsafe(method(speechSynthesizer:didEncounterErrorAtIndex:ofString:message:))]
441 #[unsafe(method_family = none)]
442 unsafe fn speechSynthesizer_didEncounterErrorAtIndex_ofString_message(
443 &self,
444 sender: &NSSpeechSynthesizer,
445 character_index: NSUInteger,
446 string: &NSString,
447 message: &NSString,
448 );
449
450 #[optional]
451 #[unsafe(method(speechSynthesizer:didEncounterSyncMessage:))]
452 #[unsafe(method_family = none)]
453 unsafe fn speechSynthesizer_didEncounterSyncMessage(
454 &self,
455 sender: &NSSpeechSynthesizer,
456 message: &NSString,
457 );
458 }
459);
460
461pub type NSSpeechMode = NSString;
464
465extern "C" {
466 pub static NSSpeechModeText: &'static NSSpeechMode;
468}
469
470extern "C" {
471 pub static NSSpeechModePhoneme: &'static NSSpeechMode;
473}
474
475extern "C" {
476 pub static NSSpeechModeNormal: &'static NSSpeechMode;
478}
479
480extern "C" {
481 pub static NSSpeechModeLiteral: &'static NSSpeechMode;
483}
484
485pub type NSSpeechStatusKey = NSString;
488
489extern "C" {
490 pub static NSSpeechStatusOutputBusy: &'static NSSpeechStatusKey;
492}
493
494extern "C" {
495 pub static NSSpeechStatusOutputPaused: &'static NSSpeechStatusKey;
497}
498
499extern "C" {
500 pub static NSSpeechStatusNumberOfCharactersLeft: &'static NSSpeechStatusKey;
502}
503
504extern "C" {
505 pub static NSSpeechStatusPhonemeCode: &'static NSSpeechStatusKey;
507}
508
509pub type NSSpeechErrorKey = NSString;
512
513extern "C" {
514 pub static NSSpeechErrorCount: &'static NSSpeechErrorKey;
516}
517
518extern "C" {
519 pub static NSSpeechErrorOldestCode: &'static NSSpeechErrorKey;
521}
522
523extern "C" {
524 pub static NSSpeechErrorOldestCharacterOffset: &'static NSSpeechErrorKey;
526}
527
528extern "C" {
529 pub static NSSpeechErrorNewestCode: &'static NSSpeechErrorKey;
531}
532
533extern "C" {
534 pub static NSSpeechErrorNewestCharacterOffset: &'static NSSpeechErrorKey;
536}
537
538pub type NSSpeechSynthesizerInfoKey = NSString;
541
542extern "C" {
543 pub static NSSpeechSynthesizerInfoIdentifier: &'static NSSpeechSynthesizerInfoKey;
545}
546
547extern "C" {
548 pub static NSSpeechSynthesizerInfoVersion: &'static NSSpeechSynthesizerInfoKey;
550}
551
552pub type NSSpeechPhonemeInfoKey = NSString;
555
556extern "C" {
557 pub static NSSpeechPhonemeInfoOpcode: &'static NSSpeechPhonemeInfoKey;
559}
560
561extern "C" {
562 pub static NSSpeechPhonemeInfoSymbol: &'static NSSpeechPhonemeInfoKey;
564}
565
566extern "C" {
567 pub static NSSpeechPhonemeInfoExample: &'static NSSpeechPhonemeInfoKey;
569}
570
571extern "C" {
572 pub static NSSpeechPhonemeInfoHiliteStart: &'static NSSpeechPhonemeInfoKey;
574}
575
576extern "C" {
577 pub static NSSpeechPhonemeInfoHiliteEnd: &'static NSSpeechPhonemeInfoKey;
579}
580
581pub type NSSpeechCommandDelimiterKey = NSString;
584
585extern "C" {
586 pub static NSSpeechCommandPrefix: &'static NSSpeechCommandDelimiterKey;
588}
589
590extern "C" {
591 pub static NSSpeechCommandSuffix: &'static NSSpeechCommandDelimiterKey;
593}