|
1 /* |
|
2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include "speechsynthesistester.h" |
|
22 #include "rubydebug.h" |
|
23 |
|
24 |
|
25 // ============================ MEMBER FUNCTIONS =============================== |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // CSpeechSynthesisTester::NewL |
|
29 // Two-phased constructor. |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 CSpeechSynthesisTester* CSpeechSynthesisTester::NewL( MTesterObserver& aObserver ) |
|
33 { |
|
34 RUBY_DEBUG_BLOCK( "CSpeechSynthesisTester::NewL" ); |
|
35 |
|
36 CSpeechSynthesisTester* self = |
|
37 new ( ELeave ) CSpeechSynthesisTester( aObserver ); |
|
38 |
|
39 CleanupStack::PushL( self ); |
|
40 self->ConstructL(); |
|
41 CleanupStack::Pop( self ); |
|
42 |
|
43 return self; |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CSpeechSynthesisTester::CSpeechSynthesisTester |
|
48 // C++ default constructor can NOT contain any code, that |
|
49 // might leave. |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CSpeechSynthesisTester::CSpeechSynthesisTester( MTesterObserver& aObserver ): |
|
53 CActive( EPriorityStandard ), |
|
54 iTestStatus( EIdle ), |
|
55 iObserver( aObserver ) |
|
56 { |
|
57 RUBY_DEBUG0( "CSpeechSynthesisTester::CSpeechSynthesisTester" ); |
|
58 |
|
59 CActiveScheduler::Add( this ); |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CSpeechSynthesisTester::ConstructL |
|
64 // Symbian 2nd phase constructor can leave. |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 void CSpeechSynthesisTester::ConstructL() |
|
68 { |
|
69 RUBY_DEBUG_BLOCKL( "CSpeechSynthesisTester::ConstructL" ); |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CSpeechSynthesisTester::~CSpeechSynthesisTester |
|
74 // Destructor. |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 CSpeechSynthesisTester::~CSpeechSynthesisTester() |
|
78 { |
|
79 RUBY_DEBUG0( "CSpeechSynthesisTester::~CSpeechSynthesisTester" ); |
|
80 |
|
81 Cancel(); |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CSpeechSynthesisTester::Open |
|
86 // |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 TInt CSpeechSynthesisTester::Open() |
|
90 { |
|
91 RUBY_DEBUG0( "CSpeechSynthesisTester::Open" ); |
|
92 |
|
93 return iSpeechSynthesis.Open(); |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CSpeechSynthesisTester::Close |
|
98 // |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 void CSpeechSynthesisTester::Close() |
|
102 { |
|
103 RUBY_DEBUG0( "CSpeechSynthesisTester::Close" ); |
|
104 |
|
105 iSpeechSynthesis.Close(); |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CSpeechSynthesisTester::SynthesisInit |
|
110 // |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 void CSpeechSynthesisTester::SynthesisInit( TDesC& aText, const TDesC& aFileName ) |
|
114 { |
|
115 RUBY_DEBUG0( "CSpeechSynthesisTester::SynthesisInit" ); |
|
116 |
|
117 Cancel(); |
|
118 SetActive(); |
|
119 |
|
120 iTestStatus = EPriming; |
|
121 |
|
122 if ( aFileName.Length() > 0 ) |
|
123 { |
|
124 iSpeechSynthesis.InitialiseSynthesis( aText, aFileName, iStatus ); |
|
125 } |
|
126 else |
|
127 { |
|
128 iSpeechSynthesis.InitialiseSynthesis( aText, iStatus ); |
|
129 } |
|
130 } |
|
131 |
|
132 // ----------------------------------------------------------------------------- |
|
133 // CSpeechSynthesisTester::Synthesise |
|
134 // |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 void CSpeechSynthesisTester::Synthesise() |
|
138 { |
|
139 RUBY_DEBUG0( "CSpeechSynthesisTester::Synthesise" ); |
|
140 |
|
141 Cancel(); |
|
142 SetActive(); |
|
143 |
|
144 iTestStatus = EPlaying; |
|
145 |
|
146 iSpeechSynthesis.Synthesise( iStatus ); |
|
147 } |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // CSpeechSynthesisTester::StopL |
|
151 // |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 void CSpeechSynthesisTester::StopL() |
|
155 { |
|
156 RUBY_DEBUG_BLOCK( "CSpeechSynthesisTester::StopL" ); |
|
157 |
|
158 iSpeechSynthesis.StopL(); |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // CSpeechSynthesisTester::PauseL |
|
163 // |
|
164 // ----------------------------------------------------------------------------- |
|
165 // |
|
166 void CSpeechSynthesisTester::PauseL() |
|
167 { |
|
168 RUBY_DEBUG_BLOCK( "CSpeechSynthesisTester::PauseL" ); |
|
169 |
|
170 iSpeechSynthesis.PauseL(); |
|
171 } |
|
172 |
|
173 // ----------------------------------------------------------------------------- |
|
174 // CSpeechSynthesisTester::GetSupportedLanguagesL |
|
175 // |
|
176 // ----------------------------------------------------------------------------- |
|
177 // |
|
178 void CSpeechSynthesisTester::GetSupportedLanguagesL( RArray<TLanguage>& aLanguages ) |
|
179 { |
|
180 RUBY_DEBUG_BLOCK( "CSpeechSynthesisTester::GetSupportedLanguagesL" ); |
|
181 |
|
182 iSpeechSynthesis.GetLanguagesL( aLanguages ); |
|
183 } |
|
184 |
|
185 // ----------------------------------------------------------------------------- |
|
186 // CSpeechSynthesisTester::GetSupportedVoicesL |
|
187 // |
|
188 // ----------------------------------------------------------------------------- |
|
189 // |
|
190 void CSpeechSynthesisTester::GetSupportedVoicesL( RArray<TVoice>& aVoices, |
|
191 TLanguage aLanguage ) |
|
192 { |
|
193 RUBY_DEBUG_BLOCK( "CSpeechSynthesisTester::GetSupportedVoicesL" ); |
|
194 |
|
195 iSpeechSynthesis.GetVoicesL( aVoices, aLanguage ); |
|
196 } |
|
197 |
|
198 // ----------------------------------------------------------------------------- |
|
199 // CSpeechSynthesisTester::VoiceL |
|
200 // |
|
201 // ----------------------------------------------------------------------------- |
|
202 // |
|
203 TVoice CSpeechSynthesisTester::VoiceL() |
|
204 { |
|
205 RUBY_DEBUG_BLOCK( "CSpeechSynthesisTester::VoiceL" ); |
|
206 |
|
207 return iSpeechSynthesis.VoiceL(); |
|
208 } |
|
209 |
|
210 // ----------------------------------------------------------------------------- |
|
211 // CSpeechSynthesisTester::SetVoiceL |
|
212 // |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 void CSpeechSynthesisTester::SetVoiceL( TVoice& aVoice ) |
|
216 { |
|
217 RUBY_DEBUG_BLOCK( "CSpeechSynthesisTester::SetVoiceL" ); |
|
218 |
|
219 iSpeechSynthesis.SetVoiceL( aVoice ); |
|
220 } |
|
221 |
|
222 // ----------------------------------------------------------------------------- |
|
223 // CSpeechSynthesisTester::MaxVolumeL |
|
224 // |
|
225 // ----------------------------------------------------------------------------- |
|
226 // |
|
227 TInt CSpeechSynthesisTester::MaxVolumeL() |
|
228 { |
|
229 RUBY_DEBUG_BLOCK( "CSpeechSynthesisTester::MaxVolumeL" ); |
|
230 |
|
231 return iSpeechSynthesis.MaxVolumeL(); |
|
232 } |
|
233 |
|
234 // ----------------------------------------------------------------------------- |
|
235 // CSpeechSynthesisTester::VolumeL |
|
236 // |
|
237 // ----------------------------------------------------------------------------- |
|
238 // |
|
239 TInt CSpeechSynthesisTester::VolumeL() |
|
240 { |
|
241 RUBY_DEBUG_BLOCK( "CSpeechSynthesisTester::VolumeL" ); |
|
242 |
|
243 return iSpeechSynthesis.VolumeL(); |
|
244 } |
|
245 |
|
246 // ----------------------------------------------------------------------------- |
|
247 // CSpeechSynthesisTester::SetVolumeL |
|
248 // |
|
249 // ----------------------------------------------------------------------------- |
|
250 // |
|
251 void CSpeechSynthesisTester::SetVolumeL( TInt aVolume ) |
|
252 { |
|
253 RUBY_DEBUG_BLOCK( "CSpeechSynthesisTester::SetVolumeL" ); |
|
254 |
|
255 iSpeechSynthesis.SetVolumeL( aVolume ); |
|
256 } |
|
257 |
|
258 // ----------------------------------------------------------------------------- |
|
259 // CSpeechSynthesisTester::MaxSpeakingRateL |
|
260 // |
|
261 // ----------------------------------------------------------------------------- |
|
262 // |
|
263 TInt CSpeechSynthesisTester::MaxSpeakingRateL() |
|
264 { |
|
265 RUBY_DEBUG_BLOCK( "CSpeechSynthesisTester::MaxSpeakingRateL" ); |
|
266 |
|
267 return iSpeechSynthesis.MaxSpeakingRateL(); |
|
268 } |
|
269 |
|
270 // ----------------------------------------------------------------------------- |
|
271 // CSpeechSynthesisTester::SpeakingRateL |
|
272 // |
|
273 // ----------------------------------------------------------------------------- |
|
274 // |
|
275 TInt CSpeechSynthesisTester::SpeakingRateL() |
|
276 { |
|
277 RUBY_DEBUG_BLOCK( "CSpeechSynthesisTester::SpeakingRateL" ); |
|
278 |
|
279 return iSpeechSynthesis.SpeakingRateL(); |
|
280 } |
|
281 |
|
282 // ----------------------------------------------------------------------------- |
|
283 // CSpeechSynthesisTester::SetSpeakingRateL |
|
284 // |
|
285 // ----------------------------------------------------------------------------- |
|
286 // |
|
287 void CSpeechSynthesisTester::SetSpeakingRateL( TInt aRate ) |
|
288 { |
|
289 RUBY_DEBUG_BLOCK( "CSpeechSynthesisTester::SetSpeakingRateL" ); |
|
290 |
|
291 iSpeechSynthesis.SetSpeakingRateL( aRate ); |
|
292 } |
|
293 |
|
294 // ----------------------------------------------------------------------------- |
|
295 // CSpeechSynthesisTester::SetAudioPriorityL |
|
296 // |
|
297 // ----------------------------------------------------------------------------- |
|
298 // |
|
299 void CSpeechSynthesisTester::SetAudioPriorityL( TInt aPriority, TInt aPreference ) |
|
300 { |
|
301 RUBY_DEBUG_BLOCK( "CSpeechSynthesisTester::SetAudioPriorityL" ); |
|
302 |
|
303 iSpeechSynthesis.SetAudioPriorityL( aPriority, aPreference ); |
|
304 } |
|
305 |
|
306 // ----------------------------------------------------------------------------- |
|
307 // CSpeechSynthesisTester::CustomCommandL |
|
308 // |
|
309 // ----------------------------------------------------------------------------- |
|
310 // |
|
311 void CSpeechSynthesisTester::CustomCommandL( TInt aCommand, TInt aValue ) |
|
312 { |
|
313 RUBY_DEBUG_BLOCK( "CSpeechSynthesisTester::CustomCommandL" ); |
|
314 |
|
315 iSpeechSynthesis.CustomCommandL( aCommand, aValue ); |
|
316 } |
|
317 |
|
318 // ----------------------------------------------------------------------------- |
|
319 // CSpeechSynthesisTester::RunL |
|
320 // |
|
321 // ----------------------------------------------------------------------------- |
|
322 // |
|
323 void CSpeechSynthesisTester::RunL() |
|
324 { |
|
325 RUBY_DEBUG_BLOCK( "CSpeechSynthesisTester::RunL" ); |
|
326 |
|
327 switch( iTestStatus ) |
|
328 { |
|
329 case EPriming: |
|
330 |
|
331 iObserver.SynthesisInitComplete( iStatus.Int() ); |
|
332 |
|
333 break; |
|
334 |
|
335 case EPlaying: |
|
336 |
|
337 iObserver.SynthesisComplete( iStatus.Int() ); |
|
338 |
|
339 break; |
|
340 |
|
341 default: |
|
342 |
|
343 RUBY_ERROR0( "CSpeechSynthesisTester::RunL - In default!" ); |
|
344 |
|
345 } |
|
346 |
|
347 iTestStatus = EIdle; |
|
348 } |
|
349 |
|
350 // ----------------------------------------------------------------------------- |
|
351 // CSpeechSynthesisTester::DoCancel |
|
352 // |
|
353 // ----------------------------------------------------------------------------- |
|
354 // |
|
355 void CSpeechSynthesisTester::DoCancel() |
|
356 { |
|
357 RUBY_DEBUG0( "CSpeechSynthesisTester::DoCancel" ); |
|
358 |
|
359 iTestStatus = EIdle; |
|
360 } |
|
361 |
|
362 // End of File |