|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "mmfdevsoundadaptation.h" |
|
21 #include "mmfdevsoundadaptationbody.h" |
|
22 |
|
23 // ============================ MEMBER FUNCTIONS =============================== |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // CMMFDevSoundAdaptation::CMMFDevSoundAdaptation |
|
27 // C++ default constructor can NOT contain any code, that |
|
28 // might leave. |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 CMMFDevSoundAdaptation::CMMFDevSoundAdaptation() |
|
32 { |
|
33 TRACE_CREATE(); |
|
34 DP_CONTEXT(CMMFDevSoundAdaptation::CMMFDevSoundAdaptation *CD1*, CtxDevSound, DPLOCAL); |
|
35 DP_IN(); |
|
36 PRF_HEAP_STATUS(PRF_MEM, HEAP_DS_Session); |
|
37 DP_OUT(); |
|
38 } |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // CMMFDevSoundAdaptation::ConstructL |
|
42 // Symbian 2nd phase constructor can leave. |
|
43 // ----------------------------------------------------------------------------- |
|
44 void CMMFDevSoundAdaptation::ConstructL(MDevSoundAdaptationObserver& aDevSoundObserver, |
|
45 MGlobalProperties& aGlobalProperties) |
|
46 { |
|
47 DP_CONTEXT(CMMFDevSoundAdaptation::ConstructL *CD1*, CtxDevSound, DPLOCAL); |
|
48 DP_IN(); |
|
49 iBody = CBody::NewL(aDevSoundObserver, aGlobalProperties); |
|
50 DP_OUT(); |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CMMFDevSoundAdaptation::NewL |
|
55 // Two-phased constructor. |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 EXPORT_C CMMFDevSoundAdaptation* CMMFDevSoundAdaptation::NewL(MDevSoundAdaptationObserver& aDevSoundObserver, |
|
59 MGlobalProperties& aGlobalProperties) |
|
60 { |
|
61 DP_STATIC_CONTEXT(CMMFDevSoundAdaptation::NewL *CD0*, CtxDevSound, DPLOCAL); |
|
62 DP_IN(); |
|
63 CMMFDevSoundAdaptation* self = new (ELeave)CMMFDevSoundAdaptation(); |
|
64 CleanupStack::PushL(self); |
|
65 self->ConstructL(aDevSoundObserver, aGlobalProperties); |
|
66 CleanupStack::Pop(self); |
|
67 DP0_RET(self, "0x%x"); |
|
68 } |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CMMFDevSoundAdaptation::ConstructL |
|
72 // Destructor |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 EXPORT_C CMMFDevSoundAdaptation::~CMMFDevSoundAdaptation() |
|
76 { |
|
77 DP_CONTEXT(CMMFDevSoundAdaptation::~CMMFDevSoundAdaptation *CD1*, CtxDevSound, DPLOCAL); |
|
78 DP_IN(); |
|
79 delete iBody; |
|
80 PRF_HEAP_STATUS(PRF_MEM, HEAP_DS_Session); |
|
81 DP_OUT(); |
|
82 } |
|
83 |
|
84 // PostOpenL() - asynchronous 2nd-phase open operation |
|
85 EXPORT_C void CMMFDevSoundAdaptation::PostOpenL() |
|
86 { |
|
87 DP_CONTEXT(CMMFDevSoundAdaptation::PostOpenL *CD1*, CtxDevSound, DPLOCAL); |
|
88 DP_IN(); |
|
89 iBody->PostOpenL(); |
|
90 DP_OUT(); |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CMMFDevSoundAdaptation::InitializeL |
|
95 // Initializes CMMFDevSoundProxy object to play and record PCM16 raw audio data |
|
96 // with sampling rate of 8 KHz.On completion of Initialization, calls |
|
97 // InitializeComplete() on aDevSoundObserver. |
|
98 // Leaves on failure. |
|
99 // (other items were commented in a header). |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 EXPORT_C void CMMFDevSoundAdaptation::InitializeL(TMMFState aMode) |
|
103 { |
|
104 DP_CONTEXT(CMMFDevSoundAdaptation::InitializeL *CD1*, CtxDevSound, DPLOCAL); |
|
105 DP_IN(); |
|
106 iBody->InitializeL(aMode); |
|
107 DP_OUT(); |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CMMFDevSoundAdaptation::InitializeL |
|
112 // Initializes DevSound object for the mode aMode for processing audio data |
|
113 // with hardware device aHWDev. On completion of Initialization, the observer |
|
114 // will be notified via call back InitializeComplete(). |
|
115 // Leaves on failure. |
|
116 // (other items were commented in a header). |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 EXPORT_C void CMMFDevSoundAdaptation::InitializeL(TUid aHWDev, |
|
120 TMMFState aMode) |
|
121 { |
|
122 DP_CONTEXT(CMMFDevSoundAdaptation::InitializeL *CD1*, CtxDevSound, DPLOCAL); |
|
123 DP_IN(); |
|
124 iBody->InitializeL(aHWDev, aMode); |
|
125 DP_OUT(); |
|
126 } |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CMMFDevSoundAdaptation::InitializeL |
|
130 // Initializes DevSound object for the mode aMode for processing audio data |
|
131 // with hardware device supporting FourCC aDesiredFourCC. On completion of |
|
132 // Initialization, the observer will be notified via callback |
|
133 // InitializeComplete(). |
|
134 // Leaves on failure. |
|
135 // (other items were commented in a header). |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 EXPORT_C void CMMFDevSoundAdaptation::InitializeL(TFourCC aDesiredFourCC, |
|
139 TMMFState aMode) |
|
140 { |
|
141 DP_CONTEXT(CMMFDevSoundAdaptation::InitializeL *CD1*, CtxDevSound, DPLOCAL); |
|
142 DP_IN(); |
|
143 iBody->InitializeL(aDesiredFourCC, aMode); |
|
144 DP_OUT(); |
|
145 } |
|
146 |
|
147 // ----------------------------------------------------------------------------- |
|
148 // CMMFDevSoundAdaptation::CancelInitialize |
|
149 // Cancels the initialization of DevSound object |
|
150 // returns an error code |
|
151 // (other items were commented in a header). |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 EXPORT_C TInt CMMFDevSoundAdaptation::CancelInitialize() |
|
155 { |
|
156 DP_CONTEXT(CMMFDevSoundAdaptation::CancelInitialize *CD1*, CtxDevSound, DPLOCAL); |
|
157 DP_IN(); |
|
158 TInt retVal = iBody->CancelInitialize(); |
|
159 DP0_RET(retVal, "%d"); |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CMMFDevSoundAdaptation::Capabilities |
|
164 // Returns the supported Audio settings. |
|
165 // (other items were commented in a header). |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 EXPORT_C TInt CMMFDevSoundAdaptation::Capabilities(TMMFCapabilities& aCap) |
|
169 { |
|
170 DP_CONTEXT(CMMFDevSoundAdaptation::Capabilities *CD1*, CtxDevSound, DPLOCAL); |
|
171 DP_IN(); |
|
172 TInt retVal = iBody->Capabilities(aCap); |
|
173 DP0_RET(retVal, "%d"); |
|
174 } |
|
175 |
|
176 // ----------------------------------------------------------------------------- |
|
177 // CMMFDevSoundAdaptation::Config |
|
178 // Returns the current audio settings. |
|
179 // (other items were commented in a header). |
|
180 // ----------------------------------------------------------------------------- |
|
181 // |
|
182 EXPORT_C TMMFCapabilities CMMFDevSoundAdaptation::Config() const |
|
183 { |
|
184 DP_CONTEXT(CMMFDevSoundAdaptation::Config *CD1*, CtxDevSound, DPLOCAL); |
|
185 DP_IN(); |
|
186 TMMFCapabilities retVal = iBody->Config(); |
|
187 DP0_RET(retVal, "%d"); |
|
188 } |
|
189 |
|
190 // ----------------------------------------------------------------------------- |
|
191 // CMMFDevSoundAdaptation::SetConfigL |
|
192 // Configure CMMFDevSoundProxy object for the settings in aConfig. |
|
193 // Use this to set sampling rate, Encoding and Mono/Stereo. |
|
194 // As part of defect 20796, the iRecordFormat has been set under the iPlayFormat, |
|
195 // before it was not set at all. |
|
196 // (other items were commented in a header). |
|
197 // ----------------------------------------------------------------------------- |
|
198 // |
|
199 EXPORT_C void CMMFDevSoundAdaptation::SetConfigL( |
|
200 const TMMFCapabilities& aConfig) |
|
201 { |
|
202 DP_CONTEXT(CMMFDevSoundAdaptation::SetConfigL *CD1*, CtxDevSound, DPLOCAL); |
|
203 DP_IN(); |
|
204 iBody->SetConfigL(aConfig); |
|
205 DP_OUT(); |
|
206 } |
|
207 |
|
208 // ----------------------------------------------------------------------------- |
|
209 // CMMFDevSoundAdaptation::MaxVolume |
|
210 // Returns an integer representing the maximum volume. |
|
211 // This is the maximum value which can be passed to CMMFDevSoundProxy::SetVolume. |
|
212 // (other items were commented in a header). |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 EXPORT_C TInt CMMFDevSoundAdaptation::MaxVolume() |
|
216 { |
|
217 DP_CONTEXT(CMMFDevSoundAdaptation::MaxVolume *CD1*, CtxDevSound, DPLOCAL); |
|
218 DP_IN(); |
|
219 TInt retVal = iBody->MaxVolume(); |
|
220 DP0_RET(retVal, "%d"); |
|
221 } |
|
222 |
|
223 // ----------------------------------------------------------------------------- |
|
224 // CMMFDevSoundAdaptation::Volume |
|
225 // Returns an integer representing the current volume. |
|
226 // (other items were commented in a header). |
|
227 // ----------------------------------------------------------------------------- |
|
228 // |
|
229 EXPORT_C TInt CMMFDevSoundAdaptation::Volume() |
|
230 { |
|
231 DP_CONTEXT(CMMFDevSoundAdaptation::Volume *CD1*, CtxDevSound, DPLOCAL); |
|
232 DP_IN(); |
|
233 TInt retVal = iBody->Volume(); |
|
234 DP0_RET(retVal, "%d"); |
|
235 } |
|
236 |
|
237 // ----------------------------------------------------------------------------- |
|
238 // CMMFDevSoundAdaptation::SetVolume |
|
239 // Changes the current playback volume to a specified value. |
|
240 // The volume can be changed before or during playback and is effective |
|
241 // immediately. |
|
242 // (other items were commented in a header). |
|
243 // ----------------------------------------------------------------------------- |
|
244 // |
|
245 EXPORT_C TInt CMMFDevSoundAdaptation::SetVolume(TInt aVolume, TBool& aAsyncCompletion) |
|
246 { |
|
247 DP_CONTEXT(CMMFDevSoundAdaptation::SetVolume *CD1*, CtxDevSound, DPLOCAL); |
|
248 DP_IN(); |
|
249 TInt error = iBody->SetVolume(aVolume, aAsyncCompletion); |
|
250 DP0_RET(error, "%d"); |
|
251 } |
|
252 |
|
253 // ----------------------------------------------------------------------------- |
|
254 // CMMFDevSoundAdaptation::MaxGain |
|
255 // Returns an integer representing the maximum gain. |
|
256 // This is the maximum value which can be passed to CMMFDevSoundProxy::SetGain. |
|
257 // (other items were commented in a header). |
|
258 // ----------------------------------------------------------------------------- |
|
259 // |
|
260 EXPORT_C TInt CMMFDevSoundAdaptation::MaxGain() |
|
261 { |
|
262 DP_CONTEXT(CMMFDevSoundAdaptation::MaxGain *CD1*, CtxDevSound, DPLOCAL); |
|
263 DP_IN(); |
|
264 TInt retVal = iBody->MaxGain(); |
|
265 DP0_RET(retVal, "%d"); |
|
266 } |
|
267 |
|
268 // ----------------------------------------------------------------------------- |
|
269 // CMMFDevSoundAdaptation::Gain |
|
270 // Returns an integer representing the current gain. |
|
271 // (other items were commented in a header). |
|
272 // ----------------------------------------------------------------------------- |
|
273 // |
|
274 EXPORT_C TInt CMMFDevSoundAdaptation::Gain() |
|
275 { |
|
276 DP_CONTEXT(CMMFDevSoundAdaptation::Gain *CD1*, CtxDevSound, DPLOCAL); |
|
277 DP_IN(); |
|
278 TInt retVal = iBody->Gain(); |
|
279 DP0_RET(retVal, "%d"); |
|
280 } |
|
281 |
|
282 // ----------------------------------------------------------------------------- |
|
283 // CMMFDevSoundAdaptation::SetGain |
|
284 // Changes the current recording gain to a specified value. |
|
285 // The gain can be changed before or during recording and is effective |
|
286 // immediately. |
|
287 // (other items were commented in a header). |
|
288 // ----------------------------------------------------------------------------- |
|
289 // |
|
290 EXPORT_C TInt CMMFDevSoundAdaptation::SetGain(TInt aGain, TBool& aAsyncCompletion) |
|
291 { |
|
292 DP_CONTEXT(CMMFDevSoundAdaptation::SetGain *CD1*, CtxDevSound, DPLOCAL); |
|
293 DP_IN(); |
|
294 TInt error = iBody->SetGain(aGain, aAsyncCompletion); |
|
295 DP0_RET(error, "%d"); |
|
296 } |
|
297 |
|
298 // ----------------------------------------------------------------------------- |
|
299 // CMMFDevSoundAdaptation::GetPlayBalanceL |
|
300 // Returns the speaker balance set for playing. |
|
301 // Leaves on failure. |
|
302 // (other items were commented in a header). |
|
303 // ----------------------------------------------------------------------------- |
|
304 // |
|
305 EXPORT_C void CMMFDevSoundAdaptation::GetPlayBalanceL( |
|
306 TInt& aLeftPercentage, |
|
307 TInt& aRightPercentage) |
|
308 { |
|
309 DP_CONTEXT(CMMFDevSoundAdaptation::GetPlayBalanceL *CD1*, CtxDevSound, DPLOCAL); |
|
310 DP_IN(); |
|
311 iBody->GetPlayBalanceL(aLeftPercentage, aRightPercentage); |
|
312 DP_OUT(); |
|
313 } |
|
314 |
|
315 // ----------------------------------------------------------------------------- |
|
316 // CMMFDevSoundAdaptation::SetPlayBalanceL |
|
317 // Sets the speaker balance for playing. The speaker balance can be changed |
|
318 // before or during playback and is effective immediately. |
|
319 // (other items were commented in a header). |
|
320 // ----------------------------------------------------------------------------- |
|
321 // |
|
322 EXPORT_C void CMMFDevSoundAdaptation::SetPlayBalanceL( |
|
323 TInt aLeftPercentage, |
|
324 TInt aRightPercentage, |
|
325 TBool& aAsyncCompletion) |
|
326 { |
|
327 DP_CONTEXT(CMMFDevSoundAdaptation::SetPlayBalanceL *CD1*, CtxDevSound, DPLOCAL); |
|
328 DP_IN(); |
|
329 iBody->SetPlayBalanceL(aLeftPercentage, aRightPercentage, aAsyncCompletion); |
|
330 DP_OUT(); |
|
331 } |
|
332 |
|
333 // ----------------------------------------------------------------------------- |
|
334 // CMMFDevSoundAdaptation::GetRecordBalanceL |
|
335 // Returns the microphone gain balance set for recording. |
|
336 // Leaves on failure. |
|
337 // (other items were commented in a header). |
|
338 // ----------------------------------------------------------------------------- |
|
339 // |
|
340 EXPORT_C void CMMFDevSoundAdaptation::GetRecordBalanceL( |
|
341 TInt& aLeftPercentage, |
|
342 TInt& aRightPercentage) |
|
343 { |
|
344 DP_CONTEXT(CMMFDevSoundAdaptation::GetRecordBalanceL *CD1*, CtxDevSound, DPLOCAL); |
|
345 DP_IN(); |
|
346 iBody->GetRecordBalanceL(aLeftPercentage, aRightPercentage); |
|
347 DP_OUT(); |
|
348 } |
|
349 |
|
350 // ----------------------------------------------------------------------------- |
|
351 // CMMFDevSoundAdaptation::SetRecordBalanceL |
|
352 // Sets the microphone gain balance for recording. |
|
353 // The microphone gain balance can be changed before or during recording and |
|
354 // is effective immediately. |
|
355 // (other items were commented in a header). |
|
356 // ----------------------------------------------------------------------------- |
|
357 // |
|
358 EXPORT_C void CMMFDevSoundAdaptation::SetRecordBalanceL( |
|
359 TInt aLeftPercentage, |
|
360 TInt aRightPercentage, |
|
361 TBool& aAsyncCompletion) |
|
362 { |
|
363 DP_CONTEXT(CMMFDevSoundAdaptation::SetRecordBalanceL *CD1*, CtxDevSound, DPLOCAL); |
|
364 DP_IN(); |
|
365 iBody->SetRecordBalanceL(aLeftPercentage, aRightPercentage, aAsyncCompletion); |
|
366 DP_OUT(); |
|
367 } |
|
368 |
|
369 // ----------------------------------------------------------------------------- |
|
370 // CMMFDevSoundAdaptation::PlayInitL |
|
371 // Initializes audio device and start play process. This method queries and |
|
372 // acquires the audio policy before initializing audio device. If there was an |
|
373 // error during policy initialization, PlayError() method will be called on |
|
374 // the observer with error code KErrAccessDenied, otherwise BufferToBeFilled() |
|
375 // method will be called with a buffer reference. After reading data into the |
|
376 // buffer reference passed, the client should call PlayData() to play data. |
|
377 // |
|
378 // The amount of data that can be played is specified in |
|
379 // CMMFBuffer::RequestSize(). Any data that is read into buffer beyond this |
|
380 // size will be ignored. |
|
381 // |
|
382 // Leaves on failure. |
|
383 // (other items were commented in a header). |
|
384 // ----------------------------------------------------------------------------- |
|
385 // |
|
386 EXPORT_C void CMMFDevSoundAdaptation::PlayInitL() |
|
387 { |
|
388 DP_CONTEXT(CMMFDevSoundAdaptation::PlayInitL *CD1*, CtxDevSound, DPLOCAL); |
|
389 DP_IN(); |
|
390 iBody->PlayInitL(); |
|
391 DP_OUT(); |
|
392 } |
|
393 |
|
394 // ----------------------------------------------------------------------------- |
|
395 // CMMFDevSoundAdaptation::RecordInitL |
|
396 // Initializes audio device and start record process. This method queries and |
|
397 // acquires the audio policy before initializing audio device. If there was an |
|
398 // error during policy initialization, RecordError() method will be called on |
|
399 // the observer with error code KErrAccessDenied, otherwise BufferToBeEmptied() |
|
400 // method will be called with a buffer reference. This buffer contains recorded |
|
401 // or encoded data. After processing data in the buffer reference passed, the |
|
402 // client should call RecordData() to continue recording process. |
|
403 // |
|
404 // The amount of data that is available is specified in |
|
405 // CMMFBuffer::RequestSize(). |
|
406 // |
|
407 // Leaves on failure. |
|
408 // (other items were commented in a header). |
|
409 // ----------------------------------------------------------------------------- |
|
410 // |
|
411 EXPORT_C void CMMFDevSoundAdaptation::RecordInitL() |
|
412 { |
|
413 DP_CONTEXT(CMMFDevSoundAdaptation::RecordInitL *CD1*, CtxDevSound, DPLOCAL); |
|
414 DP_IN(); |
|
415 iBody->RecordInitL(); |
|
416 DP_OUT(); |
|
417 } |
|
418 |
|
419 // ----------------------------------------------------------------------------- |
|
420 // CMMFDevSoundAdaptation::PlayData |
|
421 // Plays data in the buffer at the current volume. The client should fill |
|
422 // the buffer with audio data before calling this method. The Observer gets |
|
423 // reference to buffer along with callback BufferToBeFilled(). When playing of |
|
424 // the audio sample is complete, successfully or otherwise, the method |
|
425 // PlayError() on observer is called. |
|
426 // (other items were commented in a header). |
|
427 // ----------------------------------------------------------------------------- |
|
428 // |
|
429 EXPORT_C void CMMFDevSoundAdaptation::PlayData() |
|
430 { |
|
431 DP_CONTEXT(CMMFDevSoundAdaptation::PlayData *CD1*, CtxDevSound, DPLOCAL); |
|
432 DP_IN(); |
|
433 iBody->PlayData(); |
|
434 DP_OUT(); |
|
435 } |
|
436 |
|
437 // ----------------------------------------------------------------------------- |
|
438 // CMMFDevSoundAdaptation::RecordData |
|
439 // Contine the process of recording. Once the buffer is filled with recorded |
|
440 // data, the Observer gets reference to buffer along with callback |
|
441 // BufferToBeEmptied(). After processing the buffer (copying over to a |
|
442 // different buffer or writing to file) the client should call this |
|
443 // method to continue recording process. |
|
444 // (other items were commented in a header). |
|
445 // ----------------------------------------------------------------------------- |
|
446 // |
|
447 EXPORT_C void CMMFDevSoundAdaptation::RecordData() |
|
448 { |
|
449 DP_CONTEXT(CMMFDevSoundAdaptation::RecordData *CD1*, CtxDevSound, DPLOCAL); |
|
450 DP_IN(); |
|
451 iBody->RecordData(); |
|
452 DP_OUT(); |
|
453 } |
|
454 |
|
455 // ----------------------------------------------------------------------------- |
|
456 // CMMFDevSoundAdaptation::Stop |
|
457 // Stops the ongoing operation (Play, Record, TonePlay) |
|
458 // (other items were commented in a header). |
|
459 // ----------------------------------------------------------------------------- |
|
460 // |
|
461 EXPORT_C TBool CMMFDevSoundAdaptation::Stop() |
|
462 { |
|
463 DP_CONTEXT(CMMFDevSoundAdaptation::Stop *CD1*, CtxDevSound, DPLOCAL); |
|
464 DP_IN(); |
|
465 TBool retVal = iBody->Stop(); |
|
466 DP0_RET(retVal, "%d"); |
|
467 } |
|
468 |
|
469 // ----------------------------------------------------------------------------- |
|
470 // CMMFDevSoundAdaptation::Pause |
|
471 // Temporarily Stops the ongoing operation (Play, Record, TonePlay) |
|
472 // (other items were commented in a header). |
|
473 // ----------------------------------------------------------------------------- |
|
474 // |
|
475 EXPORT_C TInt CMMFDevSoundAdaptation::Pause() |
|
476 { |
|
477 DP_CONTEXT(CMMFDevSoundAdaptation::Pause *CD1*, CtxDevSound, DPLOCAL); |
|
478 DP_IN(); |
|
479 TInt retVal = iBody->Pause(); |
|
480 DP0_RET(retVal, "%d"); |
|
481 } |
|
482 |
|
483 // ----------------------------------------------------------------------------- |
|
484 // CMMFDevSoundAdaptation::SamplesRecorded |
|
485 // Returns the sample recorded so far. |
|
486 // (other items were commented in a header). |
|
487 // ----------------------------------------------------------------------------- |
|
488 // |
|
489 EXPORT_C TInt CMMFDevSoundAdaptation::SamplesRecorded() |
|
490 { |
|
491 DP_CONTEXT(CMMFDevSoundAdaptation::SamplesRecorded *CD1*, CtxDevSound, DPLOCAL); |
|
492 DP_IN(); |
|
493 TInt retVal = iBody->SamplesRecorded(); |
|
494 DP0_RET(retVal, "%d"); |
|
495 } |
|
496 |
|
497 // ----------------------------------------------------------------------------- |
|
498 // CMMFDevSoundAdaptation::SamplesPlayed |
|
499 // Returns the sample played so far. |
|
500 // (other items were commented in a header). |
|
501 // ----------------------------------------------------------------------------- |
|
502 // |
|
503 EXPORT_C TInt CMMFDevSoundAdaptation::SamplesPlayed() |
|
504 { |
|
505 DP_CONTEXT(CMMFDevSoundAdaptation::SamplesPlayed *CD1*, CtxDevSound, DPLOCAL); |
|
506 DP_IN(); |
|
507 TInt retVal = iBody->SamplesPlayed(); |
|
508 DP0_RET(retVal, "%d"); |
|
509 } |
|
510 |
|
511 // ----------------------------------------------------------------------------- |
|
512 // CMMFDevSoundAdaptation::PlayToneL |
|
513 // Initializes audio device and start playing tone. Tone is played with |
|
514 // frequency and for duration specified. |
|
515 // Leaves on failure. |
|
516 // (other items were commented in a header). |
|
517 // ----------------------------------------------------------------------------- |
|
518 // |
|
519 EXPORT_C void CMMFDevSoundAdaptation::PlayToneL( |
|
520 TInt aFrequency, |
|
521 const TTimeIntervalMicroSeconds& aDuration) |
|
522 { |
|
523 DP_CONTEXT(CMMFDevSoundAdaptation::PlayToneL *CD1*, CtxDevSound, DPLOCAL); |
|
524 DP_IN(); |
|
525 iBody->PlayToneL(aFrequency, aDuration); |
|
526 DP_OUT(); |
|
527 } |
|
528 |
|
529 // ----------------------------------------------------------------------------- |
|
530 // CMMFDevSoundAdaptation::PlayDualToneL |
|
531 // Initializes audio device and start playing a dual tone. |
|
532 // The tone consists of two sine waves of different frequencies summed together |
|
533 // Dual Tone is played with specified frequencies and for specified duration. |
|
534 // (other items were commented in a header). |
|
535 // ----------------------------------------------------------------------------- |
|
536 // |
|
537 EXPORT_C void CMMFDevSoundAdaptation::PlayDualToneL( |
|
538 TInt aFrequencyOne, |
|
539 TInt aFrequencyTwo, |
|
540 const TTimeIntervalMicroSeconds& aDuration) |
|
541 { |
|
542 DP_CONTEXT(CMMFDevSoundAdaptation::PlayDualToneL *CD1*, CtxDevSound, DPLOCAL); |
|
543 DP_IN(); |
|
544 iBody->PlayDualToneL(aFrequencyOne, aFrequencyTwo, aDuration); |
|
545 DP_OUT(); |
|
546 } |
|
547 |
|
548 // ----------------------------------------------------------------------------- |
|
549 // CMMFDevSoundAdaptation::PlayDTMFStringL |
|
550 // Initializes audio device and start playing DTMF string aDTMFString. |
|
551 // Leaves on failure. |
|
552 // (other items were commented in a header). |
|
553 // ----------------------------------------------------------------------------- |
|
554 // |
|
555 EXPORT_C void CMMFDevSoundAdaptation::PlayDTMFStringL( |
|
556 const TDesC& aDTMFString) |
|
557 { |
|
558 DP_CONTEXT(CMMFDevSoundAdaptation::PlayDTMFStringL *CD1*, CtxDevSound, DPLOCAL); |
|
559 DP_IN(); |
|
560 iBody->PlayDTMFStringL(aDTMFString); |
|
561 DP_OUT(); |
|
562 } |
|
563 |
|
564 // ----------------------------------------------------------------------------- |
|
565 // CMMFDevSoundAdaptation::PlayToneSequenceL |
|
566 // Initializes audio device and start playing tone sequence. |
|
567 // Leaves on failure. |
|
568 // (other items were commented in a header). |
|
569 // ----------------------------------------------------------------------------- |
|
570 // |
|
571 EXPORT_C void CMMFDevSoundAdaptation::PlayToneSequenceL( |
|
572 const TDesC8& aData) |
|
573 { |
|
574 DP_CONTEXT(CMMFDevSoundAdaptation::PlayToneSequenceL *CD1*, CtxDevSound, DPLOCAL); |
|
575 DP_IN(); |
|
576 iBody->PlayToneSequenceL(aData); |
|
577 DP_OUT(); |
|
578 } |
|
579 |
|
580 // ----------------------------------------------------------------------------- |
|
581 // CMMFDevSoundAdaptation::PlayFixedSequenceL |
|
582 // Initializes audio device and start playing the specified pre-defined tone |
|
583 // sequence. |
|
584 // Leaves on failure. |
|
585 // (other items were commented in a header). |
|
586 // ----------------------------------------------------------------------------- |
|
587 // |
|
588 EXPORT_C void CMMFDevSoundAdaptation::PlayFixedSequenceL( |
|
589 TInt aSequenceNumber) |
|
590 { |
|
591 DP_CONTEXT(CMMFDevSoundAdaptation::PlayFixedSequenceL *CD1*, CtxDevSound, DPLOCAL); |
|
592 DP_IN(); |
|
593 iBody->PlayFixedSequenceL(aSequenceNumber); |
|
594 DP_OUT(); |
|
595 } |
|
596 |
|
597 // ----------------------------------------------------------------------------- |
|
598 // CMMFDevSoundAdaptation::SetToneRepeats |
|
599 // Defines the number of times the audio is to be repeated during the tone |
|
600 // playback operation. A period of silence can follow each playing of tone. |
|
601 // The tone playing can be repeated indefinitely. |
|
602 // (other items were commented in a header). |
|
603 // ----------------------------------------------------------------------------- |
|
604 // |
|
605 EXPORT_C TInt CMMFDevSoundAdaptation::SetToneRepeats( |
|
606 TInt aRepeatCount, |
|
607 const TTimeIntervalMicroSeconds& aRepeatTrailingSilence) |
|
608 { |
|
609 DP_CONTEXT(CMMFDevSoundAdaptation::SetToneRepeats *CD1*, CtxDevSound, DPLOCAL); |
|
610 DP_IN(); |
|
611 TInt retVal = iBody->SetToneRepeats(aRepeatCount, aRepeatTrailingSilence); |
|
612 DP0_RET(retVal, "%d"); |
|
613 } |
|
614 |
|
615 // ----------------------------------------------------------------------------- |
|
616 // CMMFDevSoundAdaptation::SetDTMFLengths |
|
617 // Defines the duration of tone on, tone off and tone pause to be used during the |
|
618 // DTMF tone playback operation. |
|
619 // Supported only during tone playing. |
|
620 // (other items were commented in a header). |
|
621 // ----------------------------------------------------------------------------- |
|
622 // |
|
623 EXPORT_C TInt CMMFDevSoundAdaptation::SetDTMFLengths( |
|
624 TTimeIntervalMicroSeconds32& aToneOnLength, |
|
625 TTimeIntervalMicroSeconds32& aToneOffLength, |
|
626 TTimeIntervalMicroSeconds32& aPauseLength) |
|
627 { |
|
628 DP_CONTEXT(CMMFDevSoundAdaptation::SetDTMFLengths *CD1*, CtxDevSound, DPLOCAL); |
|
629 DP_IN(); |
|
630 TInt retVal = iBody->SetDTMFLengths(aToneOnLength, aToneOffLength, aPauseLength); |
|
631 DP0_RET(retVal, "%d"); |
|
632 } |
|
633 |
|
634 // ----------------------------------------------------------------------------- |
|
635 // CMMFDevSoundAdaptation::SetVolumeRamp |
|
636 // Defines the period over which the volume level is to rise smoothly from |
|
637 // nothing to the normal volume level. |
|
638 // (other items were commented in a header). |
|
639 // ----------------------------------------------------------------------------- |
|
640 // |
|
641 EXPORT_C TInt CMMFDevSoundAdaptation::SetVolumeRamp( |
|
642 const TTimeIntervalMicroSeconds& aRampDuration) |
|
643 { |
|
644 DP_CONTEXT(CMMFDevSoundAdaptation::SetVolumeRamp *CD1*, CtxDevSound, DPLOCAL); |
|
645 DP_IN(); |
|
646 TInt retVal = iBody->SetVolumeRamp(aRampDuration); |
|
647 DP0_RET(retVal, "%d"); |
|
648 } |
|
649 |
|
650 // ----------------------------------------------------------------------------- |
|
651 // CMMFDevSoundAdaptation::SetPrioritySettings |
|
652 // Defines the priority settings that should be used for this instance. |
|
653 // (other items were commented in a header). |
|
654 // ----------------------------------------------------------------------------- |
|
655 // |
|
656 EXPORT_C TInt CMMFDevSoundAdaptation::SetPrioritySettings( |
|
657 const TMMFPrioritySettings& aPrioritySettings) |
|
658 { |
|
659 DP_CONTEXT(CMMFDevSoundAdaptation::SetPrioritySettings *CD1*, CtxDevSound, DPLOCAL); |
|
660 DP_IN(); |
|
661 TInt retVal = iBody->SetPrioritySettings(aPrioritySettings); |
|
662 DP0_RET(retVal, "%d"); |
|
663 } |
|
664 |
|
665 // ----------------------------------------------------------------------------- |
|
666 // CMMFDevSoundAdaptation::CustomInterface |
|
667 // see sounddevice.h |
|
668 // (other items were commented in a header). |
|
669 // ----------------------------------------------------------------------------- |
|
670 // |
|
671 EXPORT_C TAny* CMMFDevSoundAdaptation::CustomInterface( |
|
672 TUid aInterfaceId) |
|
673 { |
|
674 DP_CONTEXT(CMMFDevSoundAdaptation::CustomInterface *CD1*, CtxDevSound, DPLOCAL); |
|
675 DP_IN(); |
|
676 DP_OUT(); |
|
677 // TODO - Need to revisit this to allow for async operation |
|
678 TAny* retVal = iBody->CustomInterface(aInterfaceId); |
|
679 DP0_RET(retVal, "0x%x"); |
|
680 } |
|
681 |
|
682 // ----------------------------------------------------------------------------- |
|
683 // CMMFDevSoundAdaptation::FixedSequenceCount |
|
684 // Returns the number of available pre-defined tone sequences. |
|
685 // This is the number of fixed sequence supported by DevSound by default. |
|
686 // (other items were commented in a header). |
|
687 // ----------------------------------------------------------------------------- |
|
688 // |
|
689 EXPORT_C TInt CMMFDevSoundAdaptation::FixedSequenceCount() |
|
690 { |
|
691 DP_CONTEXT(CMMFDevSoundAdaptation::FixedSequenceCount *CD1*, CtxDevSound, DPLOCAL); |
|
692 DP_IN(); |
|
693 TInt retVal = iBody->FixedSequenceCount(); |
|
694 DP0_RET(retVal, "%d"); |
|
695 } |
|
696 |
|
697 // ----------------------------------------------------------------------------- |
|
698 // CMMFDevSoundAdaptation::FixedSequenceName |
|
699 // Returns the name assigned to a specific pre-defined tone sequence. |
|
700 // This is the number of fixed sequence supported by DevSound by default. |
|
701 // The function raises a panic if sequence number specified invalid. |
|
702 // (other items were commented in a header). |
|
703 // ----------------------------------------------------------------------------- |
|
704 // |
|
705 EXPORT_C const TDesC& CMMFDevSoundAdaptation::FixedSequenceName( |
|
706 TInt aSequenceNumber) |
|
707 { |
|
708 DP_CONTEXT(CMMFDevSoundAdaptation::FixedSequenceName *CD1*, CtxDevSound, DPLOCAL); |
|
709 DP_IN(); |
|
710 DP_OUT(); |
|
711 return(iBody->FixedSequenceName(aSequenceNumber)); |
|
712 } |
|
713 |
|
714 // ----------------------------------------------------------------------------- |
|
715 // CMMFDevSoundAdaptation::GetSupportedInputDataTypesL |
|
716 // see sounddevice.h |
|
717 // (other items were commented in a header). |
|
718 // ----------------------------------------------------------------------------- |
|
719 // |
|
720 EXPORT_C void CMMFDevSoundAdaptation::GetSupportedInputDataTypesL( |
|
721 RArray<TFourCC>& aSupportedDataTypes, |
|
722 const TMMFPrioritySettings& aPrioritySettings) const |
|
723 { |
|
724 DP_CONTEXT(CMMFDevSoundAdaptation::GetSupportedInputDataTypesL *CD1*, CtxDevSound, DPLOCAL); |
|
725 DP_IN(); |
|
726 iBody->GetSupportedInputDataTypesL(aSupportedDataTypes, aPrioritySettings); |
|
727 DP_OUT(); |
|
728 } |
|
729 |
|
730 // ----------------------------------------------------------------------------- |
|
731 // CMMFDevSoundAdaptation::GetSupportedOutputDataTypesL |
|
732 // see sounddevice.h |
|
733 // (other items were commented in a header). |
|
734 // ----------------------------------------------------------------------------- |
|
735 // |
|
736 EXPORT_C void CMMFDevSoundAdaptation::GetSupportedOutputDataTypesL( |
|
737 RArray<TFourCC>& aSupportedDataTypes, |
|
738 const TMMFPrioritySettings& aPrioritySettings) const |
|
739 { |
|
740 DP_CONTEXT(CMMFDevSoundAdaptation::GetSupportedOutputDataTypesL *CD1*, CtxDevSound, DPLOCAL); |
|
741 DP_IN(); |
|
742 iBody->GetSupportedOutputDataTypesL(aSupportedDataTypes, aPrioritySettings); |
|
743 DP_OUT(); |
|
744 } |
|
745 |
|
746 // ----------------------------------------------------------------------------- |
|
747 // SetClientConfig |
|
748 // Sets client capabilities for this instance of DevSound Adaptation. |
|
749 // (other items were commented in a header). |
|
750 // ----------------------------------------------------------------------------- |
|
751 // |
|
752 EXPORT_C TInt CMMFDevSoundAdaptation::SetClientConfig( |
|
753 const TProcessId& aProcessId) |
|
754 { |
|
755 DP_CONTEXT(CMMFDevSoundAdaptation::SetClientConfig *CD1*, CtxDevSound, DPLOCAL); |
|
756 DP_IN(); |
|
757 TInt retVal = iBody->SetClientConfig(aProcessId); |
|
758 DP0_RET(retVal, "%d"); |
|
759 } |
|
760 |
|
761 EXPORT_C TInt CMMFDevSoundAdaptation::SetClientConfig( |
|
762 const TProcessId& aActualProcessId, |
|
763 const TProcessId& aProcessId) |
|
764 { |
|
765 DP_CONTEXT(CMMFDevSoundAdaptation::SetClientConfig *CD1*, CtxDevSound, DPLOCAL); |
|
766 DP_IN(); |
|
767 TInt retVal = iBody->SetClientConfig(aActualProcessId, aProcessId); |
|
768 DP0_RET(retVal, "%d"); |
|
769 } |
|
770 |
|
771 // ----------------------------------------------------------------------------- |
|
772 // CMMFDevSoundAdaptation::EmptyBuffers |
|
773 // |
|
774 // (other items were commented in a header). |
|
775 // ----------------------------------------------------------------------------- |
|
776 |
|
777 EXPORT_C TInt CMMFDevSoundAdaptation::EmptyBuffers() |
|
778 { |
|
779 DP_CONTEXT(CMMFDevSoundAdaptation::EmptyBuffers *CD1*, CtxDevSound, DPLOCAL); |
|
780 DP_IN(); |
|
781 TInt retVal = iBody->EmptyBuffers(); |
|
782 DP0_RET(retVal, "%d"); |
|
783 } |
|
784 |
|
785 // ----------------------------------------------------------------------------- |
|
786 // CMMFDevSoundAdaptation::CloseDevSound |
|
787 // (other items were commented in a header). |
|
788 // ----------------------------------------------------------------------------- |
|
789 // |
|
790 EXPORT_C TBool CMMFDevSoundAdaptation::CloseDevSound() |
|
791 { |
|
792 DP_CONTEXT(CMMFDevSoundAdaptation::::CloseDevSound *CD1*, CtxDevSound, DPLOCAL); |
|
793 DP_IN(); |
|
794 TBool rerVal= iBody->CloseDevSound(); |
|
795 DP0_RET(rerVal, "%d"); |
|
796 } |
|
797 |
|
798 // ----------------------------------------------------------------------------- |
|
799 // CMMFDevSoundAdaptation::ProcessingFinished |
|
800 // (other items were commented in a header). |
|
801 // ----------------------------------------------------------------------------- |
|
802 // |
|
803 EXPORT_C TInt CMMFDevSoundAdaptation::ProcessingFinishedReceived(TBool& asyncOperation) |
|
804 { |
|
805 DP_CONTEXT(CMMFDevSoundAdaptation::::ProcessingFinished *CD1*, CtxDevSound, DPLOCAL); |
|
806 DP_IN(); |
|
807 TInt retVal = iBody->ProcessingFinishedReceived(asyncOperation); |
|
808 DP0_RET(retVal, "%d"); |
|
809 } |
|
810 |
|
811 // ----------------------------------------------------------------------------- |
|
812 // CMMFDevSoundAdaptation::ProcessingFinished |
|
813 // (other items were commented in a header). |
|
814 // ----------------------------------------------------------------------------- |
|
815 // |
|
816 EXPORT_C TInt CMMFDevSoundAdaptation::ProcessingError(TBool& asyncOperation) |
|
817 { |
|
818 DP_CONTEXT(CMMFDevSoundAdaptation::::ProcessingError *CD1*, CtxDevSound, DPLOCAL); |
|
819 DP_IN(); |
|
820 TInt retVal = iBody->ProcessingError(asyncOperation); |
|
821 DP0_RET(retVal, "%d"); |
|
822 } |
|
823 |
|
824 // ----------------------------------------------------------------------------- |
|
825 // CMMFDevSoundAdaptation::RegisterAsClient |
|
826 // (other items were commented in a header). |
|
827 // ----------------------------------------------------------------------------- |
|
828 // |
|
829 EXPORT_C TInt CMMFDevSoundAdaptation::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData) |
|
830 { |
|
831 DP_CONTEXT(CMMFDevSoundAdaptation::RegisterAsClient *CD1*, CtxDevSound, DPLOCAL); |
|
832 DP_IN(); |
|
833 TInt error = iBody->RegisterAsClient(aEventType, aNotificationRegistrationData); |
|
834 DP0_RET(error, "%d"); |
|
835 } |
|
836 |
|
837 |
|
838 // ----------------------------------------------------------------------------- |
|
839 // CMMFDevSoundAdaptation::CancelRegisterAsClient |
|
840 // (other items were commented in a header). |
|
841 // ----------------------------------------------------------------------------- |
|
842 // |
|
843 EXPORT_C TInt CMMFDevSoundAdaptation::CancelRegisterAsClient(TUid aEventType) |
|
844 { |
|
845 DP_CONTEXT(CMMFDevSoundAdaptation::CancelRegisterAsClient *CD1*, CtxDevSound, DPLOCAL); |
|
846 DP_IN(); |
|
847 TInt error = iBody->CancelRegisterAsClient(aEventType); |
|
848 DP0_RET(error, "%d"); |
|
849 } |
|
850 |
|
851 |
|
852 // ----------------------------------------------------------------------------- |
|
853 // CMMFDevSoundAdaptation::GetResourceNotificationData |
|
854 // (other items were commented in a header). |
|
855 // ----------------------------------------------------------------------------- |
|
856 // |
|
857 EXPORT_C TInt CMMFDevSoundAdaptation::GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData) |
|
858 { |
|
859 DP_CONTEXT(CMMFDevSoundAdaptation::GetResourceNotificationData *CD1*, CtxDevSound, DPLOCAL); |
|
860 DP_IN(); |
|
861 TInt error = iBody->GetResourceNotificationData(aEventType, aNotificationData); |
|
862 DP0_RET(error, "%d"); |
|
863 } |
|
864 |
|
865 |
|
866 // ----------------------------------------------------------------------------- |
|
867 // CMMFDevSoundAdaptation::WillResumePlay |
|
868 // (other items were commented in a header). |
|
869 // ----------------------------------------------------------------------------- |
|
870 // |
|
871 EXPORT_C TInt CMMFDevSoundAdaptation::WillResumePlay() |
|
872 { |
|
873 DP_CONTEXT(CMMFDevSoundAdaptation::WillResumePlay *CD1*, CtxDevSound, DPLOCAL); |
|
874 DP_IN(); |
|
875 TInt error = iBody->WillResumePlay(); |
|
876 DP0_RET(error, "%d"); |
|
877 } |
|
878 |
|
879 // ----------------------------------------------------------------------------- |
|
880 // CMMFDevSoundAdaptation::GetTimePlayed |
|
881 // (other items were commented in a header). |
|
882 // ----------------------------------------------------------------------------- |
|
883 // |
|
884 EXPORT_C TInt CMMFDevSoundAdaptation::GetTimePlayed(TTimeIntervalMicroSeconds& aTime) |
|
885 { |
|
886 DP_CONTEXT(CMMFDevSoundAdaptation::GetTimePlayed *CD1*, CtxDevSound, DPLOCAL); |
|
887 DP_IN(); |
|
888 DP_OUT(); |
|
889 return iBody->GetTimePlayed(aTime); |
|
890 } |
|
891 |
|
892 // ----------------------------------------------------------------------------- |
|
893 // CMMFDevSoundAdaptation::IsResumeSupported |
|
894 // (other items were commented in a header). |
|
895 // ----------------------------------------------------------------------------- |
|
896 // |
|
897 EXPORT_C TBool CMMFDevSoundAdaptation::IsResumeSupported() |
|
898 { |
|
899 DP_CONTEXT(CMMFDevSoundAdaptation::IsResumeSupported *CD1*, CtxDevSound, DPLOCAL); |
|
900 DP_IN(); |
|
901 TBool isSupported = iBody->IsResumeSupported(); |
|
902 DP0_RET(isSupported , "%d"); |
|
903 } |
|
904 |
|
905 // ----------------------------------------------------------------------------- |
|
906 // CMMFDevSoundAdaptation::IsResumeSupported |
|
907 // (other items were commented in a header). |
|
908 // ----------------------------------------------------------------------------- |
|
909 // |
|
910 EXPORT_C TInt CMMFDevSoundAdaptation::Resume() |
|
911 { |
|
912 DP_CONTEXT(CMMFDevSoundAdaptation::Resume *CD1*, CtxDevSound, DPLOCAL); |
|
913 DP_IN(); |
|
914 TInt error = iBody->Resume(); |
|
915 DP0_RET(error, "%d"); |
|
916 } |
|
917 |
|
918 EXPORT_C void CMMFDevSoundAdaptation::BufferErrorEvent() |
|
919 { |
|
920 iBody->BufferErrorEvent(); |
|
921 } |
|
922 |
|
923 EXPORT_C void CMMFDevSoundAdaptation::RollbackAdaptorActiveStateToBeforeCommit() |
|
924 { |
|
925 DP_CONTEXT(CMMFDevSoundAdaptation::RollbackAdaptorActiveStateToBeforeCommit *CD1*, CtxDevSound, DPLOCAL); |
|
926 DP_IN(); |
|
927 iBody->RollbackAdaptorActiveStateToBeforeCommit(); |
|
928 DP_OUT(); |
|
929 } |
|
930 |
|
931 // End of file |