Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSSpeechSynthesizer.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * | |
11 * Port to the D Programming language: | |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | |
13 *******************************************************************************/ | |
14 module dwt.internal.cocoa.NSSpeechSynthesizer; | |
15 | |
16 import dwt.internal.cocoa.NSArray; | |
17 import dwt.internal.cocoa.NSDictionary; | |
18 import dwt.internal.cocoa.NSObject; | |
19 import dwt.internal.cocoa.NSString; | |
20 import dwt.internal.cocoa.NSURL; | |
21 import dwt.internal.cocoa.OS; | |
22 import objc = dwt.internal.objc.runtime; | |
23 | |
24 | |
25 | |
26 enum NSSpeechBoundar : NSUInteger | |
27 { | |
28 NSSpeechImmediateBoundary = 0, | |
29 NSSpeechWordBoundary, | |
30 NSSpeechSentenceBoundary | |
31 } | |
32 | |
33 alias NSSpeechBoundar.NSSpeechImmediateBoundary NSSpeechImmediateBoundary; | |
34 alias NSSpeechBoundar.NSSpeechWordBoundary NSSpeechWordBoundary; | |
35 alias NSSpeechBoundar.NSSpeechSentenceBoundary NSSpeechSentenceBoundary; | |
36 | |
37 | |
38 | |
39 public class NSSpeechSynthesizer : NSObject | |
40 { | |
41 | |
42 public this () | |
43 { | |
44 super(); | |
45 } | |
46 | |
47 public this (objc.id id) | |
48 { | |
49 super(id); | |
50 } | |
51 | |
52 public void addSpeechDictionary (NSDictionary speechDictionary) | |
53 { | |
54 OS.objc_msgSend(this.id, OS.sel_addSpeechDictionary_1, speechDictionary !is null ? speechDictionary.id : null); | |
55 } | |
56 | |
57 public static NSDictionary attributesForVoice (NSString voice) | |
58 { | |
59 objc.id result = OS.objc_msgSend(OS.class_NSSpeechSynthesizer, OS.sel_attributesForVoice_1, voice !is null ? voice.id : null); | |
60 return result !is null ? new NSDictionary(result) : null; | |
61 } | |
62 | |
63 public static NSArray availableVoices () | |
64 { | |
65 objc.id result = OS.objc_msgSend(OS.class_NSSpeechSynthesizer, OS.sel_availableVoices); | |
66 return result !is null ? new NSArray(result) : null; | |
67 } | |
68 | |
69 public void continueSpeaking () | |
70 { | |
71 OS.objc_msgSend(this.id, OS.sel_continueSpeaking); | |
72 } | |
73 | |
74 public static NSString defaultVoice () | |
75 { | |
76 objc.id result = OS.objc_msgSend(OS.class_NSSpeechSynthesizer, OS.sel_defaultVoice); | |
77 return result !is null ? new NSString(result) : null; | |
78 } | |
79 | |
80 public id delegatee () | |
81 { | |
82 objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate); | |
83 return result !is null ? new id(result) : null; | |
84 } | |
85 | |
86 public id initWithVoice (NSString voice) | |
87 { | |
88 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithVoice_1, voice !is null ? voice.id : null); | |
89 return result !is null ? new id(result) : null; | |
90 } | |
91 | |
92 public static bool isAnyApplicationSpeaking () | |
93 { | |
94 return OS.objc_msgSend(OS.class_NSSpeechSynthesizer, OS.sel_isAnyApplicationSpeaking) !is null; | |
95 } | |
96 | |
97 public bool isSpeaking () | |
98 { | |
99 return OS.objc_msgSend(this.id, OS.sel_isSpeaking) !is null; | |
100 } | |
101 | |
102 public id objectForProperty (NSString property, objc.id** outError) | |
103 { | |
104 objc.id result = OS.objc_msgSend(this.id, OS.sel_objectForProperty_1error_1, property !is null ? property.id : null, outError); | |
105 return result !is null ? new id(result) : null; | |
106 } | |
107 | |
108 public void pauseSpeakingAtBoundary (NSSpeechBoundar boundary) | |
109 { | |
110 OS.objc_msgSend(this.id, OS.sel_pauseSpeakingAtBoundary_1, boundary); | |
111 } | |
112 | |
113 public NSString phonemesFromText (NSString text) | |
114 { | |
115 objc.id result = OS.objc_msgSend(this.id, OS.sel_phonemesFromText_1, text !is null ? text.id : null); | |
116 return result !is null ? new NSString(result) : null; | |
117 } | |
118 | |
119 public float rate () | |
120 { | |
121 return cast(float) OS.objc_msgSend_fpret(this.id, OS.sel_rate); | |
122 } | |
123 | |
124 public void setDelegate (id anObject) | |
125 { | |
126 OS.objc_msgSend(this.id, OS.sel_setDelegate_1, anObject !is null ? anObject.id : null); | |
127 } | |
128 | |
129 public bool setObject (id object, NSString property, objc.id** outError) | |
130 { | |
131 return OS.objc_msgSend(this.id, OS.sel_setObject_1forProperty_1error_1, object !is null ? object.id : null, | |
132 property !is null ? property.id : null, outError) !is null; | |
133 } | |
134 | |
135 public void setRate (float rate) | |
136 { | |
137 OS.objc_msgSend(this.id, OS.sel_setRate_1, rate); | |
138 } | |
139 | |
140 public void setUsesFeedbackWindow (bool flag) | |
141 { | |
142 OS.objc_msgSend(this.id, OS.sel_setUsesFeedbackWindow_1, flag); | |
143 } | |
144 | |
145 public bool setVoice (NSString voice) | |
146 { | |
147 return OS.objc_msgSend(this.id, OS.sel_setVoice_1, voice !is null ? voice.id : null) !is null; | |
148 } | |
149 | |
150 public void setVolume (float volume) | |
151 { | |
152 OS.objc_msgSend(this.id, OS.sel_setVolume_1, volume); | |
153 } | |
154 | |
155 public bool startSpeakingString_ (NSString string) | |
156 { | |
157 return OS.objc_msgSend(this.id, OS.sel_startSpeakingString_1, string !is null ? string.id : null) !is null; | |
158 } | |
159 | |
160 public bool startSpeakingString_toURL_ (NSString string, NSURL url) | |
161 { | |
162 return OS.objc_msgSend(this.id, OS.sel_startSpeakingString_1toURL_1, string !is null ? string.id : null, url !is null ? url.id : null) !is null; | |
163 } | |
164 | |
165 public void stopSpeaking () | |
166 { | |
167 OS.objc_msgSend(this.id, OS.sel_stopSpeaking); | |
168 } | |
169 | |
170 public void stopSpeakingAtBoundary (NSSpeechBoundar boundary) | |
171 { | |
172 OS.objc_msgSend(this.id, OS.sel_stopSpeakingAtBoundary_1, boundary); | |
173 } | |
174 | |
175 public bool usesFeedbackWindow () | |
176 { | |
177 return OS.objc_msgSend(this.id, OS.sel_usesFeedbackWindow) !is null; | |
178 } | |
179 | |
180 public NSString voice () | |
181 { | |
182 objc.id result = OS.objc_msgSend(this.id, OS.sel_voice); | |
183 return result !is null ? new NSString(result) : null; | |
184 } | |
185 | |
186 public float volume () | |
187 { | |
188 return cast(float) OS.objc_msgSend_fpret(this.id, OS.sel_volume); | |
189 } | |
190 | |
191 } |