|
1 /* |
|
2 * Copyright (c) 2004-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: Common data types for TTS |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "srsfbldvariant.hrh" |
|
22 #include "ttscommonbody.h" |
|
23 #include "nssttscommon.h" |
|
24 |
|
25 |
|
26 // ============================ MEMBER FUNCTIONS =============================== |
|
27 // ---------------------------- TTtsStyle ------------------------------- |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // TTtsStyle::TTtsStyle |
|
31 // C++ default constructor can NOT contain any code, that |
|
32 // might leave. |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 EXPORT_C TTtsStyle::TTtsStyle() : |
|
36 iLanguage( KTtsUndefinedLanguage ), |
|
37 iVoice( KNullDesC ), |
|
38 iRate( KTtsRateUndefined ), |
|
39 iVolume( KTtsDefaultVolume ), |
|
40 iSamplingRate( KTtsRateUndefined ), |
|
41 iQuality( ETtsQualityUndefined ), |
|
42 iDuration( KTtsUndefinedDuration ), |
|
43 iNlp( EFalse ) |
|
44 { |
|
45 // nothing |
|
46 } |
|
47 |
|
48 |
|
49 // ---------------------------- TTtsSegment ------------------------------- |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // TTtsSegment::TTtsSegment |
|
53 // C++ default constructor can NOT contain any code, that |
|
54 // might leave. |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 EXPORT_C TTtsSegment::TTtsSegment( |
|
58 const TTtsStyleID aStyleID, |
|
59 const TDesC& aText, |
|
60 const TDesC8& aPhonemeSequence, |
|
61 const TTimeIntervalMicroSeconds32& aTrailingSilenceDuration ) : |
|
62 iStyleID( aStyleID ), |
|
63 iText( aText ), |
|
64 iPhonemeSequence( aPhonemeSequence ), |
|
65 iTrailingSilenceDuration( aTrailingSilenceDuration ), |
|
66 iIncludesStyle( EFalse ) |
|
67 { |
|
68 // nothing |
|
69 } |
|
70 |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // TTtsSegment::SetTrailingSilenceL |
|
74 // Sets the duration of trailing silence |
|
75 // (other items were commented in a header). |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 EXPORT_C void TTtsSegment::SetTrailingSilenceL( |
|
79 const TTimeIntervalMicroSeconds32& aDuration ) |
|
80 { |
|
81 iTrailingSilenceDuration = aDuration; |
|
82 } |
|
83 |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // TTtsSegment::SetPhonemeSequencePtr |
|
87 // Sets phoneme sequence pointer |
|
88 // (other items were commented in a header). |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 EXPORT_C void TTtsSegment::SetPhonemeSequencePtr( |
|
92 const TDesC8& aPhonemeSequence ) |
|
93 { |
|
94 iPhonemeSequence.Set( aPhonemeSequence ); |
|
95 } |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // TTtsSegment::PhonemeSequencePtr |
|
99 // Returns phoneme sequence pointer |
|
100 // (other items were commented in a header). |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 EXPORT_C const TDesC8& TTtsSegment::PhonemeSequencePtr() const |
|
104 { |
|
105 return iPhonemeSequence; |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // TTtsSegment::SetTextPtr |
|
110 // Sets text pointer |
|
111 // (other items were commented in a header). |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 EXPORT_C void TTtsSegment::SetTextPtr( |
|
115 const TDesC& aText ) |
|
116 { |
|
117 iText.Set( aText ); |
|
118 } |
|
119 // ----------------------------------------------------------------------------- |
|
120 // TTtsSegment::TrailingSilence |
|
121 // Gets duration of trailing silence |
|
122 // (other items were commented in a header). |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 EXPORT_C const TTimeIntervalMicroSeconds32& TTtsSegment::TrailingSilence() const |
|
126 { |
|
127 return iTrailingSilenceDuration; |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // TTtsSegment::TextPtr |
|
132 // Returns text pointer |
|
133 // (other items were commented in a header). |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 EXPORT_C const TDesC& TTtsSegment::TextPtr() const |
|
137 { |
|
138 return iText; |
|
139 } |
|
140 |
|
141 // ----------------------------------------------------------------------------- |
|
142 // TTtsSegment::SetStyleID |
|
143 // Sets style identifier |
|
144 // (other items were commented in a header). |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 EXPORT_C void TTtsSegment::SetStyleID( |
|
148 TTtsStyleID aStyleID ) |
|
149 { |
|
150 iStyleID = aStyleID; |
|
151 } |
|
152 |
|
153 // ----------------------------------------------------------------------------- |
|
154 // TTtsSegment::StyleID |
|
155 // Returns style identifier |
|
156 // (other items were commented in a header). |
|
157 // ----------------------------------------------------------------------------- |
|
158 // |
|
159 EXPORT_C TTtsStyleID TTtsSegment::StyleID() const |
|
160 { |
|
161 return iStyleID; |
|
162 } |
|
163 |
|
164 // ----------------------------------------------------------------------------- |
|
165 // TTtsSegment::SetStyle |
|
166 // Sets the style object for this segment. |
|
167 // ----------------------------------------------------------------------------- |
|
168 // |
|
169 EXPORT_C void TTtsSegment::SetStyle( TTtsStyle& aStyle ) |
|
170 { |
|
171 iStyle = aStyle; |
|
172 iIncludesStyle = ETrue; |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // TTtsSegment::StyleL |
|
177 // Returns style object assigned to this segment. |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 EXPORT_C TTtsStyle& TTtsSegment::StyleL() |
|
181 { |
|
182 if ( !iIncludesStyle ) |
|
183 { |
|
184 User::Leave( KErrNotFound ); |
|
185 } |
|
186 return iStyle; |
|
187 } |
|
188 |
|
189 // ----------------------------------------------------------------------------- |
|
190 // TTtsSegment::ResetStyle |
|
191 // Resets style object, style id will be used instead. |
|
192 // ----------------------------------------------------------------------------- |
|
193 // |
|
194 EXPORT_C void TTtsSegment::ResetStyle() |
|
195 { |
|
196 iIncludesStyle = EFalse; |
|
197 } |
|
198 |
|
199 // ---------------------------- CTtsParsedText ------------------------------- |
|
200 |
|
201 // ----------------------------------------------------------------------------- |
|
202 // CTtsParsedText::CTtsParsedText |
|
203 // C++ default constructor can NOT contain any code, that |
|
204 // might leave. |
|
205 // ----------------------------------------------------------------------------- |
|
206 // |
|
207 CTtsParsedText::CTtsParsedText() : |
|
208 iBody( NULL ), |
|
209 iReserved( NULL ) |
|
210 { |
|
211 // nothing |
|
212 } |
|
213 |
|
214 // ----------------------------------------------------------------------------- |
|
215 // CTtsParsedText::ConstructL |
|
216 // Symbian 2nd phase constructor can leave. |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 void CTtsParsedText::ConstructL( |
|
220 const TDesC& aText, |
|
221 const TDesC8& aPhonemeSequence, |
|
222 const TDesC& aPhonemeNotation ) |
|
223 { |
|
224 iBody = CTtsParsedTextBody::NewL( aText, |
|
225 aPhonemeSequence, |
|
226 aPhonemeNotation ); |
|
227 } |
|
228 |
|
229 // ----------------------------------------------------------------------------- |
|
230 // CTtsParsedText::NewL |
|
231 // Two-phased constructor. |
|
232 // ----------------------------------------------------------------------------- |
|
233 // |
|
234 EXPORT_C CTtsParsedText* CTtsParsedText::NewL( |
|
235 const TDesC& aText, |
|
236 const TDesC8& aPhonemeSequence, |
|
237 const TDesC& aPhonemeNotation ) |
|
238 { |
|
239 CTtsParsedText* self = new( ELeave ) CTtsParsedText; |
|
240 |
|
241 CleanupStack::PushL( self ); |
|
242 self->ConstructL( aText, |
|
243 aPhonemeSequence, |
|
244 aPhonemeNotation ); |
|
245 CleanupStack::Pop(); |
|
246 |
|
247 return self; |
|
248 } |
|
249 |
|
250 |
|
251 // Destructor |
|
252 EXPORT_C CTtsParsedText::~CTtsParsedText() |
|
253 { |
|
254 delete iBody; |
|
255 } |
|
256 |
|
257 |
|
258 // ----------------------------------------------------------------------------- |
|
259 // CTtsParsedText::AddSegmentL |
|
260 // Call corresponding function of CTtsParsedTextBody |
|
261 // (other items were commented in a header). |
|
262 // ----------------------------------------------------------------------------- |
|
263 // |
|
264 EXPORT_C void CTtsParsedText::AddSegmentL( |
|
265 const TTtsSegment& aSegment, |
|
266 TInt aIndex ) |
|
267 { |
|
268 iBody->AddSegmentL( aSegment, aIndex ); |
|
269 } |
|
270 |
|
271 // ----------------------------------------------------------------------------- |
|
272 // CTtsParsedText::DeleteSegment |
|
273 // Call corresponding function of CTtsParsedTextBody |
|
274 // (other items were commented in a header). |
|
275 // ----------------------------------------------------------------------------- |
|
276 // |
|
277 EXPORT_C void CTtsParsedText::DeleteSegmentL( |
|
278 TInt aIndex ) |
|
279 { |
|
280 iBody->DeleteSegmentL( aIndex ); |
|
281 } |
|
282 |
|
283 // ----------------------------------------------------------------------------- |
|
284 // CTtsParsedText::IsValid |
|
285 // Call corresponding function of CTtsParsedTextBody |
|
286 // (other items were commented in a header). |
|
287 // ----------------------------------------------------------------------------- |
|
288 // |
|
289 EXPORT_C TInt CTtsParsedText::IsValid() const |
|
290 { |
|
291 return iBody->IsValid(); |
|
292 } |
|
293 |
|
294 // ----------------------------------------------------------------------------- |
|
295 // CTtsParsedText::NumberOfSegments |
|
296 // Call corresponding function of CTtsParsedTextBody |
|
297 // (other items were commented in a header). |
|
298 // ----------------------------------------------------------------------------- |
|
299 // |
|
300 EXPORT_C TInt CTtsParsedText::NumberOfSegments() const |
|
301 { |
|
302 return iBody->NumberOfSegments(); |
|
303 } |
|
304 |
|
305 // ----------------------------------------------------------------------------- |
|
306 // CTtsParsedText::PhonemeNotation |
|
307 // Call corresponding function of CTtsParsedTextBody |
|
308 // (other items were commented in a header). |
|
309 // ----------------------------------------------------------------------------- |
|
310 // |
|
311 EXPORT_C const TDesC& CTtsParsedText::PhonemeNotation() const |
|
312 { |
|
313 return iBody->PhonemeNotation(); |
|
314 } |
|
315 |
|
316 // ----------------------------------------------------------------------------- |
|
317 // CTtsParsedText::PhonemeSequence |
|
318 // Call corresponding function of CTtsParsedTextBody |
|
319 // (other items were commented in a header). |
|
320 // ----------------------------------------------------------------------------- |
|
321 // |
|
322 EXPORT_C const TDesC8& CTtsParsedText::PhonemeSequence() const |
|
323 { |
|
324 return iBody->PhonemeSequence(); |
|
325 } |
|
326 |
|
327 // ----------------------------------------------------------------------------- |
|
328 // CTtsParsedText::SegmentL |
|
329 // Call corresponding function of CTtsParsedTextBody |
|
330 // (other items were commented in a header). |
|
331 // ----------------------------------------------------------------------------- |
|
332 // |
|
333 EXPORT_C const TTtsSegment& CTtsParsedText::SegmentL( |
|
334 TInt aIndex ) const |
|
335 { |
|
336 return iBody->SegmentL( aIndex ); |
|
337 } |
|
338 |
|
339 // ----------------------------------------------------------------------------- |
|
340 // CTtsParsedText::SetPhonemeNotationL |
|
341 // Call corresponding function of CTtsParsedTextBody |
|
342 // (other items were commented in a header). |
|
343 // ----------------------------------------------------------------------------- |
|
344 // |
|
345 EXPORT_C void CTtsParsedText::SetPhonemeNotationL( |
|
346 const TDesC& aPhonemeNotation ) |
|
347 { |
|
348 iBody->SetPhonemeNotationL( aPhonemeNotation ); |
|
349 } |
|
350 |
|
351 // ----------------------------------------------------------------------------- |
|
352 // CTtsParsedText::SetPhonemeSequenceL |
|
353 // Call corresponding function of CTtsParsedTextBody |
|
354 // (other items were commented in a header). |
|
355 // ----------------------------------------------------------------------------- |
|
356 // |
|
357 EXPORT_C void CTtsParsedText::SetPhonemeSequenceL( |
|
358 const TDesC8& aPhonemeSequence ) |
|
359 { |
|
360 iBody->SetPhonemeSequenceL( aPhonemeSequence ); |
|
361 } |
|
362 |
|
363 // ----------------------------------------------------------------------------- |
|
364 // CTtsParsedText::SetTextL |
|
365 // Call corresponding function of CTtsParsedTextBody |
|
366 // (other items were commented in a header). |
|
367 // ----------------------------------------------------------------------------- |
|
368 // |
|
369 EXPORT_C void CTtsParsedText::SetTextL( |
|
370 const TDesC& aText ) |
|
371 { |
|
372 iBody->SetTextL( aText ); |
|
373 } |
|
374 |
|
375 |
|
376 // ----------------------------------------------------------------------------- |
|
377 // CTtsParsedText::Text |
|
378 // Call corresponding function of CTtsParsedTextBody |
|
379 // (other items were commented in a header). |
|
380 // ----------------------------------------------------------------------------- |
|
381 // |
|
382 EXPORT_C const TDesC& CTtsParsedText::Text() const |
|
383 { |
|
384 return iBody->Text(); |
|
385 } |
|
386 |
|
387 // End of File |