comparison dstep/appkit/NSSpeechSynthesizer.d @ 16:19885b43130e

Huge update, the bridge actually works now
author Jacob Carlborg <doob@me.com>
date Sun, 03 Jan 2010 22:06:11 +0100
parents
children b9de51448c6b
comparison
equal deleted inserted replaced
15:7ff919f595d5 16:19885b43130e
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Sep 24, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.appkit.NSSpeechSynthesizer;
8
9 import dstep.appkit.AppKitDefines;
10 import dstep.foundation.NSArray;
11 import dstep.foundation.NSDictionary;
12 import dstep.foundation.NSError;
13 import dstep.foundation.NSObjCRuntime;
14 import dstep.foundation.NSObject;
15 import dstep.foundation.NSRange;
16 import dstep.foundation.NSString;
17 import dstep.foundation.NSURL;
18 import dstep.objc.bridge.Bridge;
19 import dstep.objc.objc;
20
21 import bindings = dstep.appkit.NSSpeechSynthesizer_bindings;
22
23 alias NSUInteger NSSpeechBoundary;
24
25 private
26 {
27 NSString NSVoiceName_;
28 NSString NSVoiceIdentifier_;
29 NSString NSVoiceAge_;
30 NSString NSVoiceGender_;
31 NSString NSVoiceDemoText_;
32 NSString NSVoiceLocaleIdentifier_;
33 NSString NSVoiceSupportedCharacters_;
34 NSString NSVoiceIndividuallySpokenCharacters_;
35 NSString NSVoiceGenderNeuter_;
36 NSString NSVoiceGenderMale_;
37 NSString NSVoiceGenderFemale_;
38 NSString NSSpeechStatusProperty_;
39 NSString NSSpeechErrorsProperty_;
40 NSString NSSpeechInputModeProperty_;
41 NSString NSSpeechCharacterModeProperty_;
42 NSString NSSpeechNumberModeProperty_;
43 NSString NSSpeechRateProperty_;
44 NSString NSSpeechPitchBaseProperty_;
45 NSString NSSpeechPitchModProperty_;
46 NSString NSSpeechVolumeProperty_;
47 NSString NSSpeechSynthesizerInfoProperty_;
48 NSString NSSpeechRecentSyncProperty_;
49 NSString NSSpeechPhonemeSymbolsProperty_;
50 NSString NSSpeechCurrentVoiceProperty_;
51 NSString NSSpeechCommandDelimiterProperty_;
52 NSString NSSpeechResetProperty_;
53 NSString NSSpeechOutputToFileURLProperty_;
54 NSString NSSpeechModeText_;
55 NSString NSSpeechModePhoneme_;
56 NSString NSSpeechModeNormal_;
57 NSString NSSpeechModeLiteral_;
58 NSString NSSpeechStatusOutputBusy_;
59 NSString NSSpeechStatusOutputPaused_;
60 NSString NSSpeechStatusNumberOfCharactersLeft_;
61 NSString NSSpeechStatusPhonemeCode_;
62 NSString NSSpeechErrorCount_;
63 NSString NSSpeechErrorOldestCode_;
64 NSString NSSpeechErrorOldestCharacterOffset_;
65 NSString NSSpeechErrorNewestCode_;
66 NSString NSSpeechErrorNewestCharacterOffset_;
67 NSString NSSpeechSynthesizerInfoIdentifier_;
68 NSString NSSpeechSynthesizerInfoVersion_;
69 NSString NSSpeechPhonemeInfoOpcode_;
70 NSString NSSpeechPhonemeInfoSymbol_;
71 NSString NSSpeechPhonemeInfoExample_;
72 NSString NSSpeechPhonemeInfoHiliteStart_;
73 NSString NSSpeechPhonemeInfoHiliteEnd_;
74 NSString NSSpeechCommandPrefix_;
75 NSString NSSpeechCommandSuffix_;
76 NSString NSSpeechDictionaryLocaleIdentifier_;
77 NSString NSSpeechDictionaryModificationDate_;
78 NSString NSSpeechDictionaryPronunciations_;
79 NSString NSSpeechDictionaryAbbreviations_;
80 NSString NSSpeechDictionaryEntrySpelling_;
81 NSString NSSpeechDictionaryEntryPhonemes_;
82 }
83
84 NSString NSVoiceName ()
85 {
86 if (NSVoiceName_)
87 return NSVoiceName_;
88
89 return NSVoiceName_ = new NSString(bindings.NSVoiceName);
90 }
91
92 NSString NSVoiceIdentifier ()
93 {
94 if (NSVoiceIdentifier_)
95 return NSVoiceIdentifier_;
96
97 return NSVoiceIdentifier_ = new NSString(bindings.NSVoiceIdentifier);
98 }
99
100 NSString NSVoiceAge ()
101 {
102 if (NSVoiceAge_)
103 return NSVoiceAge_;
104
105 return NSVoiceAge_ = new NSString(bindings.NSVoiceAge);
106 }
107
108 NSString NSVoiceGender ()
109 {
110 if (NSVoiceGender_)
111 return NSVoiceGender_;
112
113 return NSVoiceGender_ = new NSString(bindings.NSVoiceGender);
114 }
115
116 NSString NSVoiceDemoText ()
117 {
118 if (NSVoiceDemoText_)
119 return NSVoiceDemoText_;
120
121 return NSVoiceDemoText_ = new NSString(bindings.NSVoiceDemoText);
122 }
123
124 NSString NSVoiceLocaleIdentifier ()
125 {
126 if (NSVoiceLocaleIdentifier_)
127 return NSVoiceLocaleIdentifier_;
128
129 return NSVoiceLocaleIdentifier_ = new NSString(bindings.NSVoiceLocaleIdentifier);
130 }
131
132 NSString NSVoiceSupportedCharacters ()
133 {
134 if (NSVoiceSupportedCharacters_)
135 return NSVoiceSupportedCharacters_;
136
137 return NSVoiceSupportedCharacters_ = new NSString(bindings.NSVoiceSupportedCharacters);
138 }
139
140 NSString NSVoiceIndividuallySpokenCharacters ()
141 {
142 if (NSVoiceIndividuallySpokenCharacters_)
143 return NSVoiceIndividuallySpokenCharacters_;
144
145 return NSVoiceIndividuallySpokenCharacters_ = new NSString(bindings.NSVoiceIndividuallySpokenCharacters);
146 }
147
148 NSString NSVoiceGenderNeuter ()
149 {
150 if (NSVoiceGenderNeuter_)
151 return NSVoiceGenderNeuter_;
152
153 return NSVoiceGenderNeuter_ = new NSString(bindings.NSVoiceGenderNeuter);
154 }
155
156 NSString NSVoiceGenderMale ()
157 {
158 if (NSVoiceGenderMale_)
159 return NSVoiceGenderMale_;
160
161 return NSVoiceGenderMale_ = new NSString(bindings.NSVoiceGenderMale);
162 }
163
164 NSString NSVoiceGenderFemale ()
165 {
166 if (NSVoiceGenderFemale_)
167 return NSVoiceGenderFemale_;
168
169 return NSVoiceGenderFemale_ = new NSString(bindings.NSVoiceGenderFemale);
170 }
171
172 NSString NSSpeechStatusProperty ()
173 {
174 if (NSSpeechStatusProperty_)
175 return NSSpeechStatusProperty_;
176
177 return NSSpeechStatusProperty_ = new NSString(bindings.NSSpeechStatusProperty);
178 }
179
180 NSString NSSpeechErrorsProperty ()
181 {
182 if (NSSpeechErrorsProperty_)
183 return NSSpeechErrorsProperty_;
184
185 return NSSpeechErrorsProperty_ = new NSString(bindings.NSSpeechErrorsProperty);
186 }
187
188 NSString NSSpeechInputModeProperty ()
189 {
190 if (NSSpeechInputModeProperty_)
191 return NSSpeechInputModeProperty_;
192
193 return NSSpeechInputModeProperty_ = new NSString(bindings.NSSpeechInputModeProperty);
194 }
195
196 NSString NSSpeechCharacterModeProperty ()
197 {
198 if (NSSpeechCharacterModeProperty_)
199 return NSSpeechCharacterModeProperty_;
200
201 return NSSpeechCharacterModeProperty_ = new NSString(bindings.NSSpeechCharacterModeProperty);
202 }
203
204 NSString NSSpeechNumberModeProperty ()
205 {
206 if (NSSpeechNumberModeProperty_)
207 return NSSpeechNumberModeProperty_;
208
209 return NSSpeechNumberModeProperty_ = new NSString(bindings.NSSpeechNumberModeProperty);
210 }
211
212 NSString NSSpeechRateProperty ()
213 {
214 if (NSSpeechRateProperty_)
215 return NSSpeechRateProperty_;
216
217 return NSSpeechRateProperty_ = new NSString(bindings.NSSpeechRateProperty);
218 }
219
220 NSString NSSpeechPitchBaseProperty ()
221 {
222 if (NSSpeechPitchBaseProperty_)
223 return NSSpeechPitchBaseProperty_;
224
225 return NSSpeechPitchBaseProperty_ = new NSString(bindings.NSSpeechPitchBaseProperty);
226 }
227
228 NSString NSSpeechPitchModProperty ()
229 {
230 if (NSSpeechPitchModProperty_)
231 return NSSpeechPitchModProperty_;
232
233 return NSSpeechPitchModProperty_ = new NSString(bindings.NSSpeechPitchModProperty);
234 }
235
236 NSString NSSpeechVolumeProperty ()
237 {
238 if (NSSpeechVolumeProperty_)
239 return NSSpeechVolumeProperty_;
240
241 return NSSpeechVolumeProperty_ = new NSString(bindings.NSSpeechVolumeProperty);
242 }
243
244 NSString NSSpeechSynthesizerInfoProperty ()
245 {
246 if (NSSpeechSynthesizerInfoProperty_)
247 return NSSpeechSynthesizerInfoProperty_;
248
249 return NSSpeechSynthesizerInfoProperty_ = new NSString(bindings.NSSpeechSynthesizerInfoProperty);
250 }
251
252 NSString NSSpeechRecentSyncProperty ()
253 {
254 if (NSSpeechRecentSyncProperty_)
255 return NSSpeechRecentSyncProperty_;
256
257 return NSSpeechRecentSyncProperty_ = new NSString(bindings.NSSpeechRecentSyncProperty);
258 }
259
260 NSString NSSpeechPhonemeSymbolsProperty ()
261 {
262 if (NSSpeechPhonemeSymbolsProperty_)
263 return NSSpeechPhonemeSymbolsProperty_;
264
265 return NSSpeechPhonemeSymbolsProperty_ = new NSString(bindings.NSSpeechPhonemeSymbolsProperty);
266 }
267
268 NSString NSSpeechCurrentVoiceProperty ()
269 {
270 if (NSSpeechCurrentVoiceProperty_)
271 return NSSpeechCurrentVoiceProperty_;
272
273 return NSSpeechCurrentVoiceProperty_ = new NSString(bindings.NSSpeechCurrentVoiceProperty);
274 }
275
276 NSString NSSpeechCommandDelimiterProperty ()
277 {
278 if (NSSpeechCommandDelimiterProperty_)
279 return NSSpeechCommandDelimiterProperty_;
280
281 return NSSpeechCommandDelimiterProperty_ = new NSString(bindings.NSSpeechCommandDelimiterProperty);
282 }
283
284 NSString NSSpeechResetProperty ()
285 {
286 if (NSSpeechResetProperty_)
287 return NSSpeechResetProperty_;
288
289 return NSSpeechResetProperty_ = new NSString(bindings.NSSpeechResetProperty);
290 }
291
292 NSString NSSpeechOutputToFileURLProperty ()
293 {
294 if (NSSpeechOutputToFileURLProperty_)
295 return NSSpeechOutputToFileURLProperty_;
296
297 return NSSpeechOutputToFileURLProperty_ = new NSString(bindings.NSSpeechOutputToFileURLProperty);
298 }
299
300 NSString NSSpeechModeText ()
301 {
302 if (NSSpeechModeText_)
303 return NSSpeechModeText_;
304
305 return NSSpeechModeText_ = new NSString(bindings.NSSpeechModeText);
306 }
307
308 NSString NSSpeechModePhoneme ()
309 {
310 if (NSSpeechModePhoneme_)
311 return NSSpeechModePhoneme_;
312
313 return NSSpeechModePhoneme_ = new NSString(bindings.NSSpeechModePhoneme);
314 }
315
316 NSString NSSpeechModeNormal ()
317 {
318 if (NSSpeechModeNormal_)
319 return NSSpeechModeNormal_;
320
321 return NSSpeechModeNormal_ = new NSString(bindings.NSSpeechModeNormal);
322 }
323
324 NSString NSSpeechModeLiteral ()
325 {
326 if (NSSpeechModeLiteral_)
327 return NSSpeechModeLiteral_;
328
329 return NSSpeechModeLiteral_ = new NSString(bindings.NSSpeechModeLiteral);
330 }
331
332 NSString NSSpeechStatusOutputBusy ()
333 {
334 if (NSSpeechStatusOutputBusy_)
335 return NSSpeechStatusOutputBusy_;
336
337 return NSSpeechStatusOutputBusy_ = new NSString(bindings.NSSpeechStatusOutputBusy);
338 }
339
340 NSString NSSpeechStatusOutputPaused ()
341 {
342 if (NSSpeechStatusOutputPaused_)
343 return NSSpeechStatusOutputPaused_;
344
345 return NSSpeechStatusOutputPaused_ = new NSString(bindings.NSSpeechStatusOutputPaused);
346 }
347
348 NSString NSSpeechStatusNumberOfCharactersLeft ()
349 {
350 if (NSSpeechStatusNumberOfCharactersLeft_)
351 return NSSpeechStatusNumberOfCharactersLeft_;
352
353 return NSSpeechStatusNumberOfCharactersLeft_ = new NSString(bindings.NSSpeechStatusNumberOfCharactersLeft);
354 }
355
356 NSString NSSpeechStatusPhonemeCode ()
357 {
358 if (NSSpeechStatusPhonemeCode_)
359 return NSSpeechStatusPhonemeCode_;
360
361 return NSSpeechStatusPhonemeCode_ = new NSString(bindings.NSSpeechStatusPhonemeCode);
362 }
363
364 NSString NSSpeechErrorCount ()
365 {
366 if (NSSpeechErrorCount_)
367 return NSSpeechErrorCount_;
368
369 return NSSpeechErrorCount_ = new NSString(bindings.NSSpeechErrorCount);
370 }
371
372 NSString NSSpeechErrorOldestCode ()
373 {
374 if (NSSpeechErrorOldestCode_)
375 return NSSpeechErrorOldestCode_;
376
377 return NSSpeechErrorOldestCode_ = new NSString(bindings.NSSpeechErrorOldestCode);
378 }
379
380 NSString NSSpeechErrorOldestCharacterOffset ()
381 {
382 if (NSSpeechErrorOldestCharacterOffset_)
383 return NSSpeechErrorOldestCharacterOffset_;
384
385 return NSSpeechErrorOldestCharacterOffset_ = new NSString(bindings.NSSpeechErrorOldestCharacterOffset);
386 }
387
388 NSString NSSpeechErrorNewestCode ()
389 {
390 if (NSSpeechErrorNewestCode_)
391 return NSSpeechErrorNewestCode_;
392
393 return NSSpeechErrorNewestCode_ = new NSString(bindings.NSSpeechErrorNewestCode);
394 }
395
396 NSString NSSpeechErrorNewestCharacterOffset ()
397 {
398 if (NSSpeechErrorNewestCharacterOffset_)
399 return NSSpeechErrorNewestCharacterOffset_;
400
401 return NSSpeechErrorNewestCharacterOffset_ = new NSString(bindings.NSSpeechErrorNewestCharacterOffset);
402 }
403
404 NSString NSSpeechSynthesizerInfoIdentifier ()
405 {
406 if (NSSpeechSynthesizerInfoIdentifier_)
407 return NSSpeechSynthesizerInfoIdentifier_;
408
409 return NSSpeechSynthesizerInfoIdentifier_ = new NSString(bindings.NSSpeechSynthesizerInfoIdentifier);
410 }
411
412 NSString NSSpeechSynthesizerInfoVersion ()
413 {
414 if (NSSpeechSynthesizerInfoVersion_)
415 return NSSpeechSynthesizerInfoVersion_;
416
417 return NSSpeechSynthesizerInfoVersion_ = new NSString(bindings.NSSpeechSynthesizerInfoVersion);
418 }
419
420 NSString NSSpeechPhonemeInfoOpcode ()
421 {
422 if (NSSpeechPhonemeInfoOpcode_)
423 return NSSpeechPhonemeInfoOpcode_;
424
425 return NSSpeechPhonemeInfoOpcode_ = new NSString(bindings.NSSpeechPhonemeInfoOpcode);
426 }
427
428 NSString NSSpeechPhonemeInfoSymbol ()
429 {
430 if (NSSpeechPhonemeInfoSymbol_)
431 return NSSpeechPhonemeInfoSymbol_;
432
433 return NSSpeechPhonemeInfoSymbol_ = new NSString(bindings.NSSpeechPhonemeInfoSymbol);
434 }
435
436 NSString NSSpeechPhonemeInfoExample ()
437 {
438 if (NSSpeechPhonemeInfoExample_)
439 return NSSpeechPhonemeInfoExample_;
440
441 return NSSpeechPhonemeInfoExample_ = new NSString(bindings.NSSpeechPhonemeInfoExample);
442 }
443
444 NSString NSSpeechPhonemeInfoHiliteStart ()
445 {
446 if (NSSpeechPhonemeInfoHiliteStart_)
447 return NSSpeechPhonemeInfoHiliteStart_;
448
449 return NSSpeechPhonemeInfoHiliteStart_ = new NSString(bindings.NSSpeechPhonemeInfoHiliteStart);
450 }
451
452 NSString NSSpeechPhonemeInfoHiliteEnd ()
453 {
454 if (NSSpeechPhonemeInfoHiliteEnd_)
455 return NSSpeechPhonemeInfoHiliteEnd_;
456
457 return NSSpeechPhonemeInfoHiliteEnd_ = new NSString(bindings.NSSpeechPhonemeInfoHiliteEnd);
458 }
459
460 NSString NSSpeechCommandPrefix ()
461 {
462 if (NSSpeechCommandPrefix_)
463 return NSSpeechCommandPrefix_;
464
465 return NSSpeechCommandPrefix_ = new NSString(bindings.NSSpeechCommandPrefix);
466 }
467
468 NSString NSSpeechCommandSuffix ()
469 {
470 if (NSSpeechCommandSuffix_)
471 return NSSpeechCommandSuffix_;
472
473 return NSSpeechCommandSuffix_ = new NSString(bindings.NSSpeechCommandSuffix);
474 }
475
476 NSString NSSpeechDictionaryLocaleIdentifier ()
477 {
478 if (NSSpeechDictionaryLocaleIdentifier_)
479 return NSSpeechDictionaryLocaleIdentifier_;
480
481 return NSSpeechDictionaryLocaleIdentifier_ = new NSString(bindings.NSSpeechDictionaryLocaleIdentifier);
482 }
483
484 NSString NSSpeechDictionaryModificationDate ()
485 {
486 if (NSSpeechDictionaryModificationDate_)
487 return NSSpeechDictionaryModificationDate_;
488
489 return NSSpeechDictionaryModificationDate_ = new NSString(bindings.NSSpeechDictionaryModificationDate);
490 }
491
492 NSString NSSpeechDictionaryPronunciations ()
493 {
494 if (NSSpeechDictionaryPronunciations_)
495 return NSSpeechDictionaryPronunciations_;
496
497 return NSSpeechDictionaryPronunciations_ = new NSString(bindings.NSSpeechDictionaryPronunciations);
498 }
499
500 NSString NSSpeechDictionaryAbbreviations ()
501 {
502 if (NSSpeechDictionaryAbbreviations_)
503 return NSSpeechDictionaryAbbreviations_;
504
505 return NSSpeechDictionaryAbbreviations_ = new NSString(bindings.NSSpeechDictionaryAbbreviations);
506 }
507
508 NSString NSSpeechDictionaryEntrySpelling ()
509 {
510 if (NSSpeechDictionaryEntrySpelling_)
511 return NSSpeechDictionaryEntrySpelling_;
512
513 return NSSpeechDictionaryEntrySpelling_ = new NSString(bindings.NSSpeechDictionaryEntrySpelling);
514 }
515
516 NSString NSSpeechDictionaryEntryPhonemes ()
517 {
518 if (NSSpeechDictionaryEntryPhonemes_)
519 return NSSpeechDictionaryEntryPhonemes_;
520
521 return NSSpeechDictionaryEntryPhonemes_ = new NSString(bindings.NSSpeechDictionaryEntryPhonemes);
522 }
523
524 enum
525 {
526 NSSpeechImmediateBoundary = 0,
527 NSSpeechWordBoundary,
528 NSSpeechSentenceBoundary
529 }
530
531 class NSSpeechSynthesizer : NSObject
532 {
533 mixin (ObjcWrap);
534
535 NSSpeechSynthesizer initWithVoice (NSString voice)
536 {
537 id result = invokeObjcSelf!(id, "initWithVoice:", NSString)(voice);
538 return result is this.objcObject ? this : (result !is null ? new NSSpeechSynthesizer(result) : null);
539 }
540
541 this (NSString voice)
542 {
543 super(NSSpeechSynthesizer.alloc.initWithVoice(voice).objcObject);
544 }
545
546 bool startSpeakingString (NSString string)
547 {
548 return invokeObjcSelf!(bool, "startSpeakingString:", NSString)(string);
549 }
550
551 bool startSpeakingString (NSString string, NSURL url)
552 {
553 return invokeObjcSelf!(bool, "startSpeakingString:toURL:", NSString, NSURL)(string, url);
554 }
555
556 bool isSpeaking ()
557 {
558 return invokeObjcSelf!(bool, "isSpeaking");
559 }
560
561 void stopSpeaking ()
562 {
563 return invokeObjcSelf!(void, "stopSpeaking");
564 }
565
566 void stopSpeakingAtBoundary (uint boundary)
567 {
568 return invokeObjcSelf!(void, "stopSpeakingAtBoundary:", uint)(boundary);
569 }
570
571 void pauseSpeakingAtBoundary (uint boundary)
572 {
573 return invokeObjcSelf!(void, "pauseSpeakingAtBoundary:", uint)(boundary);
574 }
575
576 void continueSpeaking ()
577 {
578 return invokeObjcSelf!(void, "continueSpeaking");
579 }
580
581 Object delegate_ ()
582 {
583 return invokeObjcSelf!(Object, "delegate");
584 }
585
586 void setDelegate (Object anObject)
587 {
588 return invokeObjcSelf!(void, "setDelegate:", Object)(anObject);
589 }
590
591 NSString voice ()
592 {
593 return invokeObjcSelf!(NSString, "voice");
594 }
595
596 bool setVoice (NSString voice)
597 {
598 return invokeObjcSelf!(bool, "setVoice:", NSString)(voice);
599 }
600
601 float rate ()
602 {
603 return invokeObjcSelf!(float, "rate");
604 }
605
606 void setRate (float rate)
607 {
608 return invokeObjcSelf!(void, "setRate:", float)(rate);
609 }
610
611 float volume ()
612 {
613 return invokeObjcSelf!(float, "volume");
614 }
615
616 void setVolume (float volume)
617 {
618 return invokeObjcSelf!(void, "setVolume:", float)(volume);
619 }
620
621 bool usesFeedbackWindow ()
622 {
623 return invokeObjcSelf!(bool, "usesFeedbackWindow");
624 }
625
626 void setUsesFeedbackWindow (bool flag)
627 {
628 return invokeObjcSelf!(void, "setUsesFeedbackWindow:", bool)(flag);
629 }
630
631 void addSpeechDictionary (NSDictionary speechDictionary)
632 {
633 return invokeObjcSelf!(void, "addSpeechDictionary:", NSDictionary)(speechDictionary);
634 }
635
636 NSString phonemesFromText (NSString text)
637 {
638 return invokeObjcSelf!(NSString, "phonemesFromText:", NSString)(text);
639 }
640
641 Object objectForProperty (NSString property, out NSError outError)
642 {
643 id error;
644
645 Object result = invokeObjcSelf!(Object, "objectForProperty:error:", NSString, id*)(property, &error);
646
647 if (error)
648 outError = new NSError(error);
649
650 return result;
651 }
652
653 bool setObject (Object object, NSString property, ref NSError outError)
654 {
655 id error;
656
657 bool result = invokeObjcSelf!(bool, "setObject:forProperty:error:", Object, NSString, id*)(object, property, &error);
658
659 if (error)
660 outError = new NSError(error);
661
662 return result;
663 }
664
665 static bool isAnyApplicationSpeaking ()
666 {
667 return invokeObjcSelfClass!(bool, "isAnyApplicationSpeaking");
668 }
669
670 static NSString defaultVoice ()
671 {
672 return invokeObjcSelfClass!(NSString, "defaultVoice");
673 }
674
675 static NSArray availableVoices ()
676 {
677 return invokeObjcSelfClass!(NSArray, "availableVoices");
678 }
679
680 static NSDictionary attributesForVoice (NSString voice)
681 {
682 return invokeObjcSelfClass!(NSDictionary, "attributesForVoice:", NSString)(voice);
683 }
684 }
685
686 const TNSSpeechSynthesizerDelegate = `
687
688 void speechSynthesizer (NSSpeechSynthesizer sender, bool finishedSpeaking)
689 {
690 return invokeObjcSelf!(void, "speechSynthesizer:didFinishSpeaking:", NSSpeechSynthesizer, bool)(sender, finishedSpeaking);
691 }
692
693 void speechSynthesizer (NSSpeechSynthesizer sender, NSRange characterRange, NSString string)
694 {
695 return invokeObjcSelf!(void, "speechSynthesizer:willSpeakWord:ofString:", NSSpeechSynthesizer, NSRange, NSString)(sender, characterRange, string);
696 }
697
698 void speechSynthesizer (NSSpeechSynthesizer sender, short phonemeOpcode)
699 {
700 return invokeObjcSelf!(void, "speechSynthesizer:willSpeakPhoneme:", NSSpeechSynthesizer, short)(sender, phonemeOpcode);
701 }
702
703 void speechSynthesizer (NSSpeechSynthesizer sender, NSUInteger characterIndex, NSString string, NSString message)
704 {
705 return invokeObjcSelf!(void, "speechSynthesizer:didEncounterErrorAtIndex:ofString:message:", NSSpeechSynthesizer, NSUInteger, NSString, NSString)(sender, characterIndex, string, message);
706 }
707
708 void speechSynthesizer (NSSpeechSynthesizer sender, NSString message)
709 {
710 return invokeObjcSelf!(void, "speechSynthesizer:didEncounterSyncMessage:", NSSpeechSynthesizer, NSString)(sender, message);
711 }
712
713 //mixin ObjcBindMethod!(speechSynthesizer, "speechSynthesizer:didFinishSpeaking:");
714 //mixin ObjcBindMethod!(speechSynthesizer, "speechSynthesizer:willSpeakWord:ofString:");
715 //mixin ObjcBindMethod!(speechSynthesizer, "speechSynthesizer:willSpeakPhoneme:");
716 //mixin ObjcBindMethod!(speechSynthesizer, "speechSynthesizer:didEncounterErrorAtIndex:ofString:message:");
717 //mixin ObjcBindMethod!(speechSynthesizer, "speechSynthesizer:didEncounterSyncMessage:");
718
719 `;
720