|
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 // INCLUDE FILES |
|
19 #include "mmfdevsoundproxy.h" |
|
20 #ifdef _DEBUG |
|
21 #include <e32debug.h> |
|
22 |
|
23 #define SYMBIAN_DEBPRN0(str) RDebug::Print(str, this) |
|
24 #define SYMBIAN_DEBPRN1(str, val1) RDebug::Print(str, this, val1) |
|
25 #define SYMBIAN_DEBPRN2(str, val1, val2) RDebug::Print(str, this, val1, val2) |
|
26 #else |
|
27 #define SYMBIAN_DEBPRN0(str) |
|
28 #define SYMBIAN_DEBPRN1(str, val1) |
|
29 #define SYMBIAN_DEBPRN2(str, val1, val2) |
|
30 #endif //_DEBUG |
|
31 |
|
32 // SYMBIAN_CHECK used to add extra asserts when MACRO is added - helps debugging overall A3F |
|
33 |
|
34 #ifdef SYMBIAN_FULL_STATE_CHECK |
|
35 #define SYMBIAN_CHECK(c,p) __ASSERT_ALWAYS(c,p) |
|
36 #else |
|
37 #define SYMBIAN_CHECK(c,p) |
|
38 #endif |
|
39 |
|
40 const TInt KMaxMessageQueueItems = 8; |
|
41 |
|
42 const TMMFCapabilities KZeroCapabilities = |
|
43 { |
|
44 0,0,0,0 // all zero's |
|
45 }; |
|
46 |
|
47 // ============================ LOCAL FUNCTIONS ================================ |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // This function raises a panic |
|
51 // |
|
52 // @param aError |
|
53 // one of the several panic codes that may be raised by this dll |
|
54 // |
|
55 // @panic EMMFDevSoundProxyPlayDataWithoutInitialize is raised when playdata |
|
56 // is called without initialization |
|
57 // @panic EMMFDevSoundProxyRecordDataWithoutInitialize is raised when |
|
58 // recorddata is called without initialization |
|
59 // |
|
60 GLDEF_C void Panic(TMMFDevSoundProxyPanicCodes aPanicCode) |
|
61 { |
|
62 User::Panic(KMMFDevSoundProxyPanicCategory, aPanicCode); |
|
63 } |
|
64 |
|
65 // ============================ MEMBER FUNCTIONS =============================== |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // RMMFDevsoundProxy::RMMFDevsoundProxy |
|
69 // C++ default constructor can NOT contain any code, that |
|
70 // might leave. |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 EXPORT_C RMMFDevSoundProxy::RMMFDevSoundProxy() : |
|
74 iBuffer(NULL), |
|
75 iSeqName(NULL), |
|
76 iDestinationPckg(TMMFMessageDestination(KUidInterfaceMMFDevSound, |
|
77 KMMFObjectHandleDevSound)), |
|
78 iState(EIdle), |
|
79 iAudioServerProxy(NULL), |
|
80 iDevSoundObserver(NULL), |
|
81 iMsgQueueHandler(NULL), |
|
82 iCustIntPckg() |
|
83 { |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // RMMFDevSoundProxy::Close |
|
88 // Close the server session |
|
89 // (other items were commented in a header). |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 EXPORT_C void RMMFDevSoundProxy::Close() |
|
93 { |
|
94 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Close - Enter")); |
|
95 if (iAudioServerProxy) |
|
96 { |
|
97 if (iAudioServerProxy->Handle() != NULL) |
|
98 { |
|
99 TMMFDevSoundProxySettings set; |
|
100 TMMFDevSoundProxySettingsPckg pckg(set); |
|
101 TInt err = SendReceive(EMMFDevSoundProxyClose, |
|
102 iDestinationPckg, |
|
103 pckg); |
|
104 } |
|
105 iAudioServerProxy->Close(); |
|
106 delete iAudioServerProxy; |
|
107 iAudioServerProxy = NULL; |
|
108 } |
|
109 RMmfSessionBase::Close(); |
|
110 iState = EIdle; |
|
111 if (iMsgQueueHandler) |
|
112 { |
|
113 iMsgQueueHandler->Cancel(); |
|
114 delete iMsgQueueHandler; |
|
115 iMsgQueueHandler = NULL; |
|
116 } |
|
117 iMsgQueue.Close(); |
|
118 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Close - Exit")); |
|
119 } |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // RMMFDevSoundProxy::Open |
|
123 // Open a DevSound server session |
|
124 // (other items were commented in a header). |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 EXPORT_C TInt RMMFDevSoundProxy::Open() |
|
128 { |
|
129 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Open - Enter")); |
|
130 TInt err = iMsgQueue.CreateGlobal(KNullDesC, KMaxMessageQueueItems, EOwnerThread); |
|
131 // global, accessible to all that have its handle |
|
132 |
|
133 if (err == KErrNone) |
|
134 { |
|
135 iAudioServerProxy = NULL; |
|
136 iMsgQueueHandler = NULL; |
|
137 iBuffer = NULL; |
|
138 iAudioServerProxy = new RMMFAudioServerProxy(); |
|
139 if (iAudioServerProxy == NULL) |
|
140 { |
|
141 err = KErrNoMemory; |
|
142 } |
|
143 } |
|
144 if (err == KErrNone) |
|
145 { |
|
146 err = iAudioServerProxy->Open(); |
|
147 } |
|
148 if (err == KErrNone) |
|
149 { |
|
150 err = SetReturnedHandle(iAudioServerProxy->GetDevSoundSessionHandle()); |
|
151 } |
|
152 if (err) |
|
153 { |
|
154 Close(); |
|
155 } |
|
156 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::Open - Exit [%d]"), err); |
|
157 return err; |
|
158 } |
|
159 |
|
160 // ----------------------------------------------------------------------------- |
|
161 // RMMFDevSoundProxy::PostOpen |
|
162 // Finish opening process |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 EXPORT_C TInt RMMFDevSoundProxy::PostOpen() |
|
166 { |
|
167 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PostOpen - Enter")); |
|
168 TInt err = SendReceive(EMMFDevSoundProxyPostOpen, iDestinationPckg); |
|
169 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::PostOpen - Exit [%d]"), err); |
|
170 return err; |
|
171 } |
|
172 |
|
173 |
|
174 // ----------------------------------------------------------------------------- |
|
175 // RMMFDevSoundProxy::SetDevSoundInfo |
|
176 // Launch DevSound that might have been waiting for audio policy. |
|
177 // (other items were commented in a header). |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 EXPORT_C TInt RMMFDevSoundProxy::SetDevSoundInfo() |
|
181 { |
|
182 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetDevSoundInfo - Enter")); |
|
183 TInt err = SendReceive(EMMFAudioLaunchRequests); |
|
184 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::SetDevSoundInfo - Exit [%d]"), err); |
|
185 return err; |
|
186 } |
|
187 |
|
188 // ----------------------------------------------------------------------------- |
|
189 // RMMFDevSoundProxy::InitializeL |
|
190 // Initialize DevSound for a specific mode. |
|
191 // (other items were commented in a header). |
|
192 // ----------------------------------------------------------------------------- |
|
193 // |
|
194 EXPORT_C void RMMFDevSoundProxy::InitializeL( |
|
195 MDevSoundObserver& aDevSoundObserver, |
|
196 TMMFState aMode, |
|
197 MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver) |
|
198 { |
|
199 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::InitializeL - Enter")); |
|
200 TInt err = KErrNone; |
|
201 iDevSoundObserver = &aDevSoundObserver; |
|
202 |
|
203 if (!(iState==EIdle || iState==EInitialized)) |
|
204 { |
|
205 err = KErrNotReady; |
|
206 } |
|
207 else |
|
208 { |
|
209 TMMFDevSoundProxySettings set; |
|
210 set.iMode = aMode; |
|
211 TMMFDevSoundProxySettingsPckg pckg(set); |
|
212 TIpcArgs args(&iDestinationPckg, &pckg, iMsgQueue); |
|
213 err = RSessionBase::SendReceive(EMMFDevSoundProxyInitialize1, args); |
|
214 if (err == KErrNone) |
|
215 { |
|
216 StartReceivingMsgQueueHandlerEventsL(aDevSoundCIObserver); |
|
217 iState = EInitializing; |
|
218 } |
|
219 } |
|
220 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::InitializeL - Exit [%d]"), err); |
|
221 User::LeaveIfError(err); |
|
222 } |
|
223 |
|
224 // ----------------------------------------------------------------------------- |
|
225 // RMMFDevSoundProxy::InitializeL |
|
226 // Initialize DevSound with specific HwDevice id and mode. |
|
227 // (other items were commented in a header). |
|
228 // ----------------------------------------------------------------------------- |
|
229 // |
|
230 EXPORT_C void RMMFDevSoundProxy::InitializeL( |
|
231 MDevSoundObserver& /*aDevSoundObserver*/, |
|
232 TUid /*aHWDev*/, |
|
233 TMMFState /*aMode*/, |
|
234 MMMFDevSoundCustomInterfaceObserver& /*aDevSoundCIObserver*/) |
|
235 { |
|
236 TInt err = KErrNotSupported; |
|
237 User::LeaveIfError(err); |
|
238 } |
|
239 |
|
240 // ----------------------------------------------------------------------------- |
|
241 // RMMFDevSoundProxy::InitializeL |
|
242 // Initialize DevSound for the specific FourCC and mode. |
|
243 // (other items were commented in a header). |
|
244 // ----------------------------------------------------------------------------- |
|
245 // |
|
246 EXPORT_C void RMMFDevSoundProxy::InitializeL( |
|
247 MDevSoundObserver& aDevSoundObserver, |
|
248 TFourCC aDesiredFourCC, |
|
249 TMMFState aMode, |
|
250 MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver) |
|
251 { |
|
252 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::InitializeL - Enter")); |
|
253 TInt err = KErrNone; |
|
254 if(aMode == EMMFStateTonePlaying) |
|
255 { |
|
256 User::Leave(KErrNotSupported); |
|
257 } |
|
258 iDevSoundObserver = &aDevSoundObserver; |
|
259 if (!(iState==EIdle || iState==EInitialized)) |
|
260 { |
|
261 err = KErrNotReady; |
|
262 } |
|
263 else |
|
264 { |
|
265 TMMFDevSoundProxySettings set; |
|
266 set.iDesiredFourCC = aDesiredFourCC; |
|
267 set.iMode = aMode; |
|
268 TMMFDevSoundProxySettingsPckg pckg(set); |
|
269 TIpcArgs args(&iDestinationPckg, &pckg, iMsgQueue); |
|
270 err = RSessionBase::SendReceive(EMMFDevSoundProxyInitialize4, args); |
|
271 if (err == KErrNone) |
|
272 { |
|
273 StartReceivingMsgQueueHandlerEventsL(aDevSoundCIObserver); |
|
274 iState = EInitializing; |
|
275 } |
|
276 } |
|
277 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::InitializeL - Exit [%d]"), err); |
|
278 User::LeaveIfError(err); |
|
279 } |
|
280 |
|
281 // ----------------------------------------------------------------------------- |
|
282 // RMMFDevSoundProxy::Capabilities |
|
283 // Returns the capabilities of the DevSound server. |
|
284 // (other items were commented in a header). |
|
285 // ----------------------------------------------------------------------------- |
|
286 // |
|
287 EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Capabilities() |
|
288 { |
|
289 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Capabilities - Enter")); |
|
290 // TODO should we use the following ? SYMBIAN_CHECK(iState>=EInitialized, Panic(EMMFDevSoundProxyCapabilitiesInWrongState)); |
|
291 if (iState < EInitialized) |
|
292 { |
|
293 // call has been made before we are initialized. Not much we can do, so return |
|
294 // dummy values but hit debugger on the emulator |
|
295 __DEBUGGER() |
|
296 RDebug::Print(_L("BRDBG:CapabilitiesCalledWhenNotInitialised")); // TODO Remove or redo as trace |
|
297 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Capabilities - Exit")); |
|
298 return KZeroCapabilities; |
|
299 } |
|
300 TMMFDevSoundProxySettings set; |
|
301 TMMFDevSoundProxySettingsPckg pckg(set); |
|
302 TInt err = SendReceiveResult(EMMFDevSoundProxyCapabilities, |
|
303 iDestinationPckg, |
|
304 KNullDesC8, |
|
305 pckg); |
|
306 if (err == KErrNone) |
|
307 { |
|
308 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Capabilities - Exit")); |
|
309 return pckg().iCaps; |
|
310 } |
|
311 else |
|
312 { |
|
313 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::Capabilities - Exit [%d]"), err); |
|
314 return KZeroCapabilities; |
|
315 } |
|
316 } |
|
317 |
|
318 // ----------------------------------------------------------------------------- |
|
319 // TMMFCapabilities RMMFDevSoundProxy::Config |
|
320 // Returns the current configuration of the DevSound. |
|
321 // (other items were commented in a header). |
|
322 // ----------------------------------------------------------------------------- |
|
323 // |
|
324 EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Config() |
|
325 { |
|
326 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Config - Enter")); |
|
327 // TODO should we use the following ? SYMBIAN_CHECK(iState>=EInitialized, Panic(EMMFDevSoundProxyConfigInWrongState)); |
|
328 if (iState < EInitialized) |
|
329 { |
|
330 // call has been made before we are initialized. Not much we can do, so return |
|
331 // dummy values but hit debugger on the emulator |
|
332 __DEBUGGER() |
|
333 RDebug::Print(_L("BRDBG:ConfigCalledWhenNotInitialised")); // TODO Remove or redo as trace |
|
334 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Config - Exit")); |
|
335 return KZeroCapabilities; |
|
336 } |
|
337 TMMFDevSoundProxySettings set; |
|
338 TMMFDevSoundProxySettingsPckg pckg(set); |
|
339 SendReceiveResult(EMMFDevSoundProxyConfig, |
|
340 iDestinationPckg, |
|
341 KNullDesC8, |
|
342 pckg); |
|
343 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Config - Exit")); |
|
344 return pckg().iConfig; |
|
345 } |
|
346 |
|
347 // ----------------------------------------------------------------------------- |
|
348 // RMMFDevSoundProxy::SetConfigL |
|
349 // Configures the DevSound server. |
|
350 // (other items were commented in a header). |
|
351 // ----------------------------------------------------------------------------- |
|
352 // |
|
353 EXPORT_C void RMMFDevSoundProxy::SetConfigL( |
|
354 const TMMFCapabilities& aConfig ) |
|
355 { |
|
356 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetConfigL - Enter")); |
|
357 TInt err = KErrNone; |
|
358 |
|
359 if (iState==EInitialized) |
|
360 { |
|
361 TMMFDevSoundProxySettings set; |
|
362 set.iConfig = aConfig; |
|
363 TMMFDevSoundProxySettingsPckg pckg(set); |
|
364 err = SendReceive(EMMFDevSoundProxySetConfig, |
|
365 iDestinationPckg, |
|
366 pckg); |
|
367 } |
|
368 else |
|
369 { |
|
370 RDebug::Print(_L("BRDBG:SetConfigCalledWhenNotInitialised")); // TODO Remove or redo as trace |
|
371 err = KErrNotReady; |
|
372 } |
|
373 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::SetConfigL - Exit [%d]"), err); |
|
374 User::LeaveIfError(err); |
|
375 } |
|
376 |
|
377 // ----------------------------------------------------------------------------- |
|
378 // RMMFDevSoundProxy::MaxVolume |
|
379 // Returns the maximum volume supported by DevSound server for playing back.. |
|
380 // (other items were commented in a header). |
|
381 // ----------------------------------------------------------------------------- |
|
382 // |
|
383 EXPORT_C TInt RMMFDevSoundProxy::MaxVolume() |
|
384 { |
|
385 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::MaxVolume - Enter")); |
|
386 TMMFDevSoundProxySettings set; |
|
387 TMMFDevSoundProxySettingsPckg pckg(set); |
|
388 SendReceiveResult(EMMFDevSoundProxyMaxVolume, |
|
389 iDestinationPckg, |
|
390 KNullDesC8, |
|
391 pckg); |
|
392 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::MaxVolume - Exit")); |
|
393 return pckg().iMaxVolume; |
|
394 } |
|
395 |
|
396 // ----------------------------------------------------------------------------- |
|
397 // RMMFDevSoundProxy::Volume |
|
398 // Returns the current volume. |
|
399 // (other items were commented in a header). |
|
400 // ----------------------------------------------------------------------------- |
|
401 // |
|
402 EXPORT_C TInt RMMFDevSoundProxy::Volume() |
|
403 { |
|
404 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Volume - Enter")); |
|
405 TMMFDevSoundProxySettings set; |
|
406 TMMFDevSoundProxySettingsPckg pckg(set); |
|
407 SendReceiveResult(EMMFDevSoundProxyVolume, |
|
408 iDestinationPckg, |
|
409 KNullDesC8, |
|
410 pckg); |
|
411 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Volume - Exit")); |
|
412 return pckg().iVolume; |
|
413 } |
|
414 |
|
415 // ----------------------------------------------------------------------------- |
|
416 // RMMFDevSoundProxy::SetVolume |
|
417 // Sets the current volume. |
|
418 // (other items were commented in a header). |
|
419 // ----------------------------------------------------------------------------- |
|
420 // |
|
421 EXPORT_C TInt RMMFDevSoundProxy::SetVolume(TInt aVolume ) |
|
422 { |
|
423 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetVolume - Enter")); |
|
424 TMMFDevSoundProxySettings set; |
|
425 set.iVolume = aVolume; |
|
426 TMMFDevSoundProxySettingsPckg pckg(set); |
|
427 TInt err = SendReceive(EMMFDevSoundProxySetVolume, |
|
428 iDestinationPckg, |
|
429 pckg); |
|
430 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::SetVolume - Exit [%d]"), err); |
|
431 return err; |
|
432 } |
|
433 |
|
434 // ----------------------------------------------------------------------------- |
|
435 // RMMFDevSoundProxy::MaxGain |
|
436 // Returns maximum gain supported by DevSound server for recording. |
|
437 // (other items were commented in a header). |
|
438 // ----------------------------------------------------------------------------- |
|
439 // |
|
440 EXPORT_C TInt RMMFDevSoundProxy::MaxGain() |
|
441 { |
|
442 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::MaxGain - Enter")); |
|
443 TMMFDevSoundProxySettings set; |
|
444 TMMFDevSoundProxySettingsPckg pckg(set); |
|
445 SendReceiveResult(EMMFDevSoundProxyMaxGain, |
|
446 iDestinationPckg, |
|
447 KNullDesC8, |
|
448 pckg); |
|
449 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::MaxGain - Exit")); |
|
450 return pckg().iMaxGain; |
|
451 } |
|
452 |
|
453 // ----------------------------------------------------------------------------- |
|
454 // RMMFDevSoundProxy::Gain |
|
455 // Returns the current gain. |
|
456 // (other items were commented in a header). |
|
457 // ----------------------------------------------------------------------------- |
|
458 // |
|
459 EXPORT_C TInt RMMFDevSoundProxy::Gain() |
|
460 { |
|
461 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Gain - Enter")); |
|
462 TMMFDevSoundProxySettings set; |
|
463 TMMFDevSoundProxySettingsPckg pckg(set); |
|
464 SendReceiveResult(EMMFDevSoundProxyGain, |
|
465 iDestinationPckg, |
|
466 KNullDesC8, |
|
467 pckg); |
|
468 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Gain - Exit")); |
|
469 return pckg().iGain; |
|
470 } |
|
471 |
|
472 // ----------------------------------------------------------------------------- |
|
473 // RMMFDevSoundProxy::SetGain |
|
474 // Sets the current gain. |
|
475 // (other items were commented in a header). |
|
476 // ----------------------------------------------------------------------------- |
|
477 // |
|
478 EXPORT_C TInt RMMFDevSoundProxy::SetGain( |
|
479 TInt aGain ) |
|
480 { |
|
481 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetGain - Enter")); |
|
482 TMMFDevSoundProxySettings set; |
|
483 set.iGain = aGain; |
|
484 TMMFDevSoundProxySettingsPckg pckg(set); |
|
485 |
|
486 TInt err = SendReceive(EMMFDevSoundProxySetGain, |
|
487 iDestinationPckg, |
|
488 pckg); |
|
489 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::SetGain - Exit [%d]"), err); |
|
490 return err; |
|
491 } |
|
492 |
|
493 // ----------------------------------------------------------------------------- |
|
494 // RMMFDevSoundProxy::GetPlayBalanceL |
|
495 // Returns play balance. |
|
496 // (other items were commented in a header). |
|
497 // ----------------------------------------------------------------------------- |
|
498 // |
|
499 EXPORT_C void RMMFDevSoundProxy::GetPlayBalanceL( |
|
500 TInt& aLeftPercentage, |
|
501 TInt& aRightPercentage ) |
|
502 { |
|
503 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetPlayBalanceL - Enter")); |
|
504 TMMFDevSoundProxySettings set; |
|
505 TMMFDevSoundProxySettingsPckg pckg(set); |
|
506 User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyPlayBalance, |
|
507 iDestinationPckg, |
|
508 KNullDesC8, |
|
509 pckg)); |
|
510 aLeftPercentage = pckg().iLeftPercentage; |
|
511 aRightPercentage = pckg().iRightPercentage; |
|
512 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetPlayBalanceL - Exit")); |
|
513 } |
|
514 |
|
515 // ----------------------------------------------------------------------------- |
|
516 // RMMFDevSoundProxy::SetPlayBalanceL |
|
517 // Sets playbalance. |
|
518 // (other items were commented in a header). |
|
519 // ----------------------------------------------------------------------------- |
|
520 // |
|
521 EXPORT_C void RMMFDevSoundProxy::SetPlayBalanceL( |
|
522 TInt aLeftPercentage, |
|
523 TInt aRightPercentage ) |
|
524 { |
|
525 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetPlayBalanceL - Enter")); |
|
526 TMMFDevSoundProxySettings set; |
|
527 set.iLeftPercentage = aLeftPercentage; |
|
528 set.iRightPercentage = aRightPercentage; |
|
529 TMMFDevSoundProxySettingsPckg pckg(set); |
|
530 User::LeaveIfError(SendReceive(EMMFDevSoundProxySetPlayBalance, |
|
531 iDestinationPckg, |
|
532 pckg)); |
|
533 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetPlayBalanceL - Exit")); |
|
534 } |
|
535 |
|
536 // ----------------------------------------------------------------------------- |
|
537 // RMMFDevSoundProxy::GetRecordBalanceL |
|
538 // Returns record balance. |
|
539 // (other items were commented in a header). |
|
540 // ----------------------------------------------------------------------------- |
|
541 // |
|
542 EXPORT_C void RMMFDevSoundProxy::GetRecordBalanceL( |
|
543 TInt& aLeftPercentage, |
|
544 TInt& aRightPercentage ) |
|
545 { |
|
546 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetRecordBalanceL - Enter")); |
|
547 TMMFDevSoundProxySettings set; |
|
548 TMMFDevSoundProxySettingsPckg pckg(set); |
|
549 User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyRecordBalance, |
|
550 iDestinationPckg, |
|
551 KNullDesC8, |
|
552 pckg)); |
|
553 aLeftPercentage = pckg().iLeftPercentage; |
|
554 aRightPercentage = pckg().iRightPercentage; |
|
555 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetRecordBalanceL - Exit")); |
|
556 } |
|
557 |
|
558 // ----------------------------------------------------------------------------- |
|
559 // RMMFDevSoundProxy::SetRecordBalanceL |
|
560 // Sets record balance. |
|
561 // (other items were commented in a header). |
|
562 // ----------------------------------------------------------------------------- |
|
563 // |
|
564 EXPORT_C void RMMFDevSoundProxy::SetRecordBalanceL( |
|
565 TInt aLeftPercentage, |
|
566 TInt aRightPercentage ) |
|
567 { |
|
568 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetRecordBalanceL - Enter")); |
|
569 TMMFDevSoundProxySettings set; |
|
570 set.iLeftPercentage = aLeftPercentage; |
|
571 set.iRightPercentage = aRightPercentage; |
|
572 TMMFDevSoundProxySettingsPckg pckg(set); |
|
573 User::LeaveIfError(SendReceive(EMMFDevSoundProxySetRecordBalance, |
|
574 iDestinationPckg, |
|
575 pckg)); |
|
576 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetRecordBalanceL - Exit")); |
|
577 } |
|
578 |
|
579 // ----------------------------------------------------------------------------- |
|
580 // RMMFDevSoundProxy::PlayInitL |
|
581 // Initilaizes DevSound to play digital audio and starts the play process. |
|
582 // (other items were commented in a header). |
|
583 // ----------------------------------------------------------------------------- |
|
584 // |
|
585 EXPORT_C void RMMFDevSoundProxy::PlayInitL() |
|
586 { |
|
587 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayInitL - Enter")); |
|
588 if (!iDevSoundObserver || iState!=EInitialized) |
|
589 { |
|
590 if (iState == EPlaying || iState == EPlayingBufferWait) |
|
591 { |
|
592 // treat PlayInitL() during play as Resume() |
|
593 User::LeaveIfError(Resume()); |
|
594 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayInitL - Exit")); |
|
595 return; |
|
596 } |
|
597 User::Leave(KErrNotReady); |
|
598 } |
|
599 |
|
600 User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayInit, |
|
601 iDestinationPckg)); |
|
602 iState = EPlaying; |
|
603 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayInitL - Exit")); |
|
604 } |
|
605 |
|
606 // ----------------------------------------------------------------------------- |
|
607 // RMMFDevSoundProxy::RecordInitL |
|
608 // Initilaizes DevSound to record digital audio and starts the record process. |
|
609 // (other items were commented in a header). |
|
610 // ----------------------------------------------------------------------------- |
|
611 // |
|
612 EXPORT_C void RMMFDevSoundProxy::RecordInitL() |
|
613 { |
|
614 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RecordInitL - Enter")); |
|
615 if (!iDevSoundObserver || iState!=EInitialized) |
|
616 { |
|
617 if(iState == ERecording || iState == ERecordingBufferWait || iState == ERecordingInLastBufferCycle |
|
618 || iState == ERecordingResumingInLastBufferCycle) |
|
619 { |
|
620 // treat RecordInitL() during record as Resume() |
|
621 User::LeaveIfError(Resume()); |
|
622 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RecordInitL - Exit")); |
|
623 return; |
|
624 } |
|
625 User::Leave(KErrNotReady); |
|
626 } |
|
627 |
|
628 User::LeaveIfError(SendReceive(EMMFDevSoundProxyRecordInit, |
|
629 iDestinationPckg)); |
|
630 iState = ERecording; |
|
631 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RecordInitL - Exit")); |
|
632 } |
|
633 |
|
634 // ----------------------------------------------------------------------------- |
|
635 // RMMFDevSoundProxy::PlayData |
|
636 // Plays the data in the buffer at the current volume. |
|
637 // (other items were commented in a header). |
|
638 // ----------------------------------------------------------------------------- |
|
639 // |
|
640 EXPORT_C void RMMFDevSoundProxy::PlayData() |
|
641 { |
|
642 //SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayData - Enter")); //Uncommenting this will produce a lot of logging! |
|
643 __ASSERT_ALWAYS(iState == EPlaying || iState == EPlayingBufferWait, |
|
644 Panic(EMMFDevSoundProxyPlayDataWithoutInitialize)); |
|
645 ASSERT(iDevSoundObserver); |
|
646 SYMBIAN_CHECK( iState == EPlayingBufferWait, |
|
647 Panic(EMMFDevSoundProxyPlayDataInWrongState)); |
|
648 TMMFDevSoundProxyHwBuf set; |
|
649 set.iLastBuffer = iBuffer->LastBuffer(); |
|
650 set.iBufferSize = iBuffer->Data().Size(); |
|
651 TMMFDevSoundProxyHwBufPckg pckg(set); |
|
652 |
|
653 SendReceive(EMMFDevSoundProxyPlayData, iDestinationPckg, pckg); |
|
654 iState = EPlaying; |
|
655 //SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayData - Exit")); //Uncommenting this will produce a lot of logging! |
|
656 } |
|
657 |
|
658 // ----------------------------------------------------------------------------- |
|
659 // RMMFDevSoundProxy::RecordData |
|
660 // Signals the device to continue recording. |
|
661 // (other items were commented in a header). |
|
662 // ----------------------------------------------------------------------------- |
|
663 // |
|
664 EXPORT_C void RMMFDevSoundProxy::RecordData() |
|
665 { |
|
666 //SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RecordData - Enter")); //Uncommenting this will produce a lot of logging! |
|
667 __ASSERT_ALWAYS(iState == ERecording || iState == ERecordingBufferWait || |
|
668 iState == ERecordingInLastBufferCycle || iState == ERecordingResumingInLastBufferCycle, |
|
669 Panic(EMMFDevSoundProxyRecordDataWithoutInitialize)); |
|
670 ASSERT(iDevSoundObserver); |
|
671 SYMBIAN_CHECK(iState == ERecordingBufferWait || iState == ERecordingInLastBufferCycle || |
|
672 iState == ERecordingResumingInLastBufferCycle, |
|
673 Panic(EMMFDevSoundProxyPlayDataInWrongState)); |
|
674 switch (iState) |
|
675 { |
|
676 case ERecordingBufferWait: |
|
677 // standard case |
|
678 SendReceive(EMMFDevSoundProxyRecordData, iDestinationPckg); |
|
679 iState = ERecording; |
|
680 break; |
|
681 case ERecordingInLastBufferCycle: |
|
682 // ack of the last buffer. Just swallow - the server should not be sent an ack |
|
683 iState = ERecording; |
|
684 break; |
|
685 case ERecordingResumingInLastBufferCycle: |
|
686 // this is a RecordData() following a Resume() in the last cycle. This is where we do the resume! |
|
687 SendReceive(EMMFDevSoundProxyResume, iDestinationPckg); // note ignore any error |
|
688 iState = ERecording; |
|
689 break; |
|
690 } |
|
691 //SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RecordData - Exit")); //Uncommenting this will produce a lot of logging! |
|
692 } |
|
693 |
|
694 // ----------------------------------------------------------------------------- |
|
695 // RMMFDevSoundProxy::Stop |
|
696 // Stops the ongoing opeartion. |
|
697 // (other items were commented in a header). |
|
698 // ----------------------------------------------------------------------------- |
|
699 // |
|
700 EXPORT_C void RMMFDevSoundProxy::Stop() |
|
701 { |
|
702 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Stop - Enter")); |
|
703 if (iState > EInitialized) |
|
704 { |
|
705 SendReceive(EMMFDevSoundProxyStop, iDestinationPckg); |
|
706 iState = EInitialized; |
|
707 iMsgQueueHandler->Finish(); // will delete the buffer |
|
708 } |
|
709 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Stop - Exit")); |
|
710 } |
|
711 |
|
712 // ----------------------------------------------------------------------------- |
|
713 // RMMFDevSoundProxy::Pause |
|
714 // Temporarily stops the ongoing operation. |
|
715 // (other items were commented in a header). |
|
716 // ----------------------------------------------------------------------------- |
|
717 // |
|
718 EXPORT_C void RMMFDevSoundProxy::Pause() |
|
719 { |
|
720 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Pause - Enter")); |
|
721 if(iState > EInitialized) |
|
722 { |
|
723 SendReceive(EMMFDevSoundProxyPause, iDestinationPckg); |
|
724 } |
|
725 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Pause - Exit")); |
|
726 } |
|
727 |
|
728 // ----------------------------------------------------------------------------- |
|
729 // RMMFDevSoundProxy::PlayToneL |
|
730 // Plays the simple tone. |
|
731 // (other items were commented in a header). |
|
732 // ----------------------------------------------------------------------------- |
|
733 // |
|
734 EXPORT_C void RMMFDevSoundProxy::PlayToneL( |
|
735 TInt aFrequency, |
|
736 const TTimeIntervalMicroSeconds& aDuration) |
|
737 { |
|
738 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneL - Enter")); |
|
739 if(iState==ETonePlaying) |
|
740 { |
|
741 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneL - Exit")); |
|
742 return; |
|
743 } |
|
744 |
|
745 if (!iDevSoundObserver || iState!=EInitialized) |
|
746 { |
|
747 User::Leave(KErrNotReady); |
|
748 } |
|
749 |
|
750 TMMFDevSoundProxySettings set; |
|
751 set.iFrequencyOne = aFrequency; |
|
752 set.iDuration = aDuration; |
|
753 TMMFDevSoundProxySettingsPckg pckg(set); |
|
754 User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayTone, |
|
755 iDestinationPckg, |
|
756 pckg)); |
|
757 iState = ETonePlaying; |
|
758 iToneMode = ESimple; |
|
759 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneL - Exit")); |
|
760 } |
|
761 |
|
762 // ----------------------------------------------------------------------------- |
|
763 // RMMFDevSoundProxy::PlayDualToneL |
|
764 // Plays the dual tone. |
|
765 // (other items were commented in a header). |
|
766 // ----------------------------------------------------------------------------- |
|
767 // |
|
768 EXPORT_C void RMMFDevSoundProxy::PlayDualToneL( |
|
769 TInt aFrequencyOne, |
|
770 TInt aFrequencyTwo, |
|
771 const TTimeIntervalMicroSeconds& aDuration) |
|
772 { |
|
773 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDualToneL - Enter")); |
|
774 if(iState==ETonePlaying) |
|
775 { |
|
776 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDualToneL - Exit")); |
|
777 return; |
|
778 } |
|
779 |
|
780 if (!iDevSoundObserver || iState!=EInitialized) |
|
781 { |
|
782 User::Leave(KErrNotReady); |
|
783 } |
|
784 |
|
785 TMMFDevSoundProxySettings set; |
|
786 set.iFrequencyOne = aFrequencyOne; |
|
787 set.iFrequencyTwo = aFrequencyTwo; |
|
788 set.iDuration = aDuration; |
|
789 TMMFDevSoundProxySettingsPckg pckg(set); |
|
790 User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayDualTone, iDestinationPckg, pckg)); |
|
791 iState = ETonePlaying; |
|
792 iToneMode = EDual; |
|
793 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDualToneL - Exit")); |
|
794 } |
|
795 |
|
796 // ----------------------------------------------------------------------------- |
|
797 // RMMFDevSoundProxy::PlayDTMFStringL |
|
798 // Plays the DTMF string. |
|
799 // (other items were commented in a header). |
|
800 // ----------------------------------------------------------------------------- |
|
801 // |
|
802 EXPORT_C void RMMFDevSoundProxy::PlayDTMFStringL(const TDesC& aDTMFString) |
|
803 { |
|
804 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDTMFStringL - Enter")); |
|
805 if(iState==ETonePlaying) |
|
806 { |
|
807 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDTMFStringL - Exit")); |
|
808 return; |
|
809 } |
|
810 |
|
811 if (!iDevSoundObserver || iState!=EInitialized) |
|
812 { |
|
813 User::Leave(KErrNotReady); |
|
814 } |
|
815 |
|
816 TPtr tempPtr(0,0); |
|
817 tempPtr.Set(CONST_CAST(TUint16*, aDTMFString.Ptr()), |
|
818 aDTMFString.Length(), |
|
819 aDTMFString.Length()); |
|
820 |
|
821 User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyPlayDTMFString, |
|
822 iDestinationPckg, |
|
823 KNullDesC8, |
|
824 tempPtr)); |
|
825 iState = ETonePlaying; |
|
826 iToneMode = EDTMFString; |
|
827 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDTMFStringL - Exit")); |
|
828 } |
|
829 |
|
830 // ----------------------------------------------------------------------------- |
|
831 // RMMFDevSoundProxy::PlayToneSequenceL |
|
832 // Plays the tone sequence. (NRT/RNG) |
|
833 // (other items were commented in a header). |
|
834 // ----------------------------------------------------------------------------- |
|
835 // |
|
836 EXPORT_C void RMMFDevSoundProxy::PlayToneSequenceL(const TDesC8& aData ) |
|
837 { |
|
838 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneSequenceL - Enter")); |
|
839 if(iState==ETonePlaying) |
|
840 { |
|
841 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneSequenceL - Exit")); |
|
842 return; |
|
843 } |
|
844 |
|
845 if (!iDevSoundObserver || iState!=EInitialized) |
|
846 { |
|
847 User::Leave(KErrNotReady); |
|
848 } |
|
849 |
|
850 User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayToneSequence, |
|
851 iDestinationPckg, |
|
852 aData)); |
|
853 iState = ETonePlaying; |
|
854 iToneMode = ESequence; |
|
855 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneSequenceL - Exit")); |
|
856 } |
|
857 |
|
858 // ----------------------------------------------------------------------------- |
|
859 // RMMFDevSoundProxy::PlayFixedSequenceL |
|
860 // Plays the fixed sequence. |
|
861 // (other items were commented in a header). |
|
862 // ----------------------------------------------------------------------------- |
|
863 // |
|
864 EXPORT_C void RMMFDevSoundProxy::PlayFixedSequenceL(TInt aSequenceNumber) |
|
865 { |
|
866 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayFixedSequenceL - Enter")); |
|
867 if(iState==ETonePlaying) |
|
868 { |
|
869 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayFixedSequenceL - Exit")); |
|
870 return; |
|
871 } |
|
872 |
|
873 if (!iDevSoundObserver || iState!=EInitialized) |
|
874 { |
|
875 User::Leave(KErrNotReady); |
|
876 } |
|
877 |
|
878 TPckgBuf<TInt> seqNum(aSequenceNumber); |
|
879 User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayFixedSequence, iDestinationPckg, seqNum)); |
|
880 iState = ETonePlaying; |
|
881 iToneMode = EFixedSequence; |
|
882 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayFixedSequenceL - Exit")); |
|
883 } |
|
884 |
|
885 // ----------------------------------------------------------------------------- |
|
886 // RMMFDevSoundProxy::SetDTMFLengths |
|
887 // Set attributes for playing DTMF String. |
|
888 // (other items were commented in a header). |
|
889 // ----------------------------------------------------------------------------- |
|
890 // |
|
891 EXPORT_C void RMMFDevSoundProxy::SetDTMFLengths( |
|
892 TTimeIntervalMicroSeconds32& aToneOnLength, |
|
893 TTimeIntervalMicroSeconds32& aToneOffLength, |
|
894 TTimeIntervalMicroSeconds32& aPauseLength ) |
|
895 { |
|
896 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetDTMFLengths - Enter")); |
|
897 TMMFDevSoundProxySettings set; |
|
898 set.iToneOnLength = aToneOnLength; |
|
899 set.iToneOffLength = aToneOffLength; |
|
900 set.iPauseLength = aPauseLength; |
|
901 TMMFDevSoundProxySettingsPckg pckg(set); |
|
902 SendReceive(EMMFDevSoundProxySetDTMFLengths, iDestinationPckg, pckg); |
|
903 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetDTMFLengths - Exit")); |
|
904 } |
|
905 |
|
906 // ----------------------------------------------------------------------------- |
|
907 // RMMFDevSoundProxy::SetVolumeRamp |
|
908 // Sets the volume ramp duration. |
|
909 // (other items were commented in a header). |
|
910 // ----------------------------------------------------------------------------- |
|
911 // |
|
912 EXPORT_C void RMMFDevSoundProxy::SetVolumeRamp( |
|
913 const TTimeIntervalMicroSeconds& aRampDuration) |
|
914 { |
|
915 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetVolumeRamp - Enter")); |
|
916 TMMFDevSoundProxySettings set; |
|
917 set.iDuration = aRampDuration; |
|
918 TMMFDevSoundProxySettingsPckg pckg(set); |
|
919 SendReceive(EMMFDevSoundProxySetVolumeRamp, iDestinationPckg, pckg); |
|
920 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetVolumeRamp - Exit")); |
|
921 } |
|
922 |
|
923 // ----------------------------------------------------------------------------- |
|
924 // RMMFDevSoundProxy::GetSupportedInputDataTypesL |
|
925 // Returns supported datatypes for playing audio. |
|
926 // (other items were commented in a header). |
|
927 // ----------------------------------------------------------------------------- |
|
928 // |
|
929 EXPORT_C void RMMFDevSoundProxy::GetSupportedInputDataTypesL( |
|
930 RArray<TFourCC>& aSupportedDataTypes, |
|
931 const TMMFPrioritySettings& aPrioritySettings) |
|
932 { |
|
933 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedInputDataTypesL - Enter")); |
|
934 aSupportedDataTypes.Reset(); |
|
935 |
|
936 TMMFPrioritySettings prioritySet = aPrioritySettings; |
|
937 TMMFPrioritySettingsPckg pckg(prioritySet); |
|
938 |
|
939 TPckgBuf<TInt> numberOfElementsPckg; |
|
940 User::LeaveIfError(SendReceiveResult( |
|
941 EMMFDevSoundProxyGetSupportedInputDataTypes, |
|
942 iDestinationPckg, |
|
943 pckg, |
|
944 numberOfElementsPckg)); |
|
945 |
|
946 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedInputDataTypesL - Exit 1")); |
|
947 |
|
948 HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC)); |
|
949 TPtr8 ptr = buf->Des(); |
|
950 |
|
951 |
|
952 User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyCopyFourCCArrayData, |
|
953 iDestinationPckg, |
|
954 KNullDesC8, |
|
955 ptr)); |
|
956 |
|
957 RDesReadStream stream(ptr); |
|
958 CleanupClosePushL(stream); |
|
959 |
|
960 |
|
961 TInt count = numberOfElementsPckg(); |
|
962 for (TInt i = 0; i < count; i++) |
|
963 { |
|
964 TInt err = aSupportedDataTypes.Append(stream.ReadInt32L()); |
|
965 if (err) |
|
966 {//note we don't destroy array because we don't own it |
|
967 //but we do reset it as it is incomplete |
|
968 aSupportedDataTypes.Reset(); |
|
969 User::Leave(err); |
|
970 } |
|
971 } |
|
972 CleanupStack::PopAndDestroy(&stream); |
|
973 CleanupStack::PopAndDestroy(buf); |
|
974 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedInputDataTypesL - Exit 2")); |
|
975 } |
|
976 |
|
977 // ----------------------------------------------------------------------------- |
|
978 // RMMFDevSoundProxy::GetSupportedOutputDataTypesL |
|
979 // Returns supported datatypes for recording audio. |
|
980 // (other items were commented in a header). |
|
981 // ----------------------------------------------------------------------------- |
|
982 // |
|
983 EXPORT_C void RMMFDevSoundProxy::GetSupportedOutputDataTypesL( |
|
984 RArray<TFourCC>& aSupportedDataTypes, |
|
985 const TMMFPrioritySettings& aPrioritySettings) |
|
986 { |
|
987 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedOutputDataTypesL - Enter")); |
|
988 aSupportedDataTypes.Reset(); |
|
989 |
|
990 TMMFPrioritySettings prioritySet = aPrioritySettings; |
|
991 TMMFPrioritySettingsPckg pckg(prioritySet); |
|
992 |
|
993 TPckgBuf<TInt> numberOfElementsPckg; |
|
994 User::LeaveIfError(SendReceiveResult( |
|
995 EMMFDevSoundProxyGetSupportedOutputDataTypes, |
|
996 iDestinationPckg, |
|
997 pckg, |
|
998 numberOfElementsPckg)); |
|
999 |
|
1000 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedOutputDataTypesL - Exit 1")); |
|
1001 |
|
1002 HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC)); |
|
1003 TPtr8 ptr = buf->Des(); |
|
1004 |
|
1005 |
|
1006 User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyCopyFourCCArrayData, |
|
1007 iDestinationPckg, |
|
1008 KNullDesC8, |
|
1009 ptr)); |
|
1010 RDesReadStream stream(ptr); |
|
1011 CleanupClosePushL(stream); |
|
1012 |
|
1013 |
|
1014 TInt count = numberOfElementsPckg(); |
|
1015 for (TInt i = 0; i < count; i++) |
|
1016 { |
|
1017 TInt err = aSupportedDataTypes.Append(stream.ReadInt32L()); |
|
1018 if (err) |
|
1019 {//note we don't destroy array because we don't own it |
|
1020 //but we do reset it as it is incomplete |
|
1021 aSupportedDataTypes.Reset(); |
|
1022 User::Leave(err); |
|
1023 } |
|
1024 } |
|
1025 CleanupStack::PopAndDestroy(&stream); |
|
1026 CleanupStack::PopAndDestroy(buf); |
|
1027 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedOutputDataTypesL - Exit 2")); |
|
1028 } |
|
1029 |
|
1030 // ----------------------------------------------------------------------------- |
|
1031 // RMMFDevSoundProxy::SamplesRecorded |
|
1032 // Returns samples recorded so far. |
|
1033 // (other items were commented in a header). |
|
1034 // ----------------------------------------------------------------------------- |
|
1035 // |
|
1036 EXPORT_C TInt RMMFDevSoundProxy::SamplesRecorded() |
|
1037 { |
|
1038 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SamplesRecorded - Enter")); |
|
1039 TPckgBuf<TInt> numSamples; |
|
1040 SendReceiveResult(EMMFDevSoundProxySamplesRecorded, |
|
1041 iDestinationPckg, |
|
1042 KNullDesC8, |
|
1043 numSamples); |
|
1044 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SamplesRecorded - Exit")); |
|
1045 return numSamples(); |
|
1046 } |
|
1047 |
|
1048 // ----------------------------------------------------------------------------- |
|
1049 // RMMFDevSoundProxy::SamplesPlayed |
|
1050 // Returns samples played so far. |
|
1051 // (other items were commented in a header). |
|
1052 // ----------------------------------------------------------------------------- |
|
1053 // |
|
1054 EXPORT_C TInt RMMFDevSoundProxy::SamplesPlayed() |
|
1055 { |
|
1056 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SamplesPlayed - Enter")); |
|
1057 TPckgBuf<TInt> numSamples; |
|
1058 SendReceiveResult(EMMFDevSoundProxySamplesPlayed, |
|
1059 iDestinationPckg, |
|
1060 KNullDesC8, |
|
1061 numSamples); |
|
1062 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SamplesPlayed - Exit")); |
|
1063 return numSamples(); |
|
1064 } |
|
1065 |
|
1066 // ----------------------------------------------------------------------------- |
|
1067 // RMMFDevSoundProxy::SetToneRepeats |
|
1068 // Sets tone repeats |
|
1069 // (other items were commented in a header). |
|
1070 // ----------------------------------------------------------------------------- |
|
1071 // |
|
1072 EXPORT_C void RMMFDevSoundProxy::SetToneRepeats( |
|
1073 TInt aRepeatCount, |
|
1074 const TTimeIntervalMicroSeconds& |
|
1075 aRepeatTrailingSilence) |
|
1076 { |
|
1077 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetToneRepeats - Enter")); |
|
1078 TPckgBuf<TInt> countRepeat(aRepeatCount); |
|
1079 TPckgBuf<TTimeIntervalMicroSeconds> repeatTS(aRepeatTrailingSilence); |
|
1080 SendReceive(EMMFDevSoundProxySetToneRepeats, |
|
1081 iDestinationPckg, |
|
1082 countRepeat, |
|
1083 repeatTS); |
|
1084 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetToneRepeats - Exit")); |
|
1085 } |
|
1086 |
|
1087 // ----------------------------------------------------------------------------- |
|
1088 // RMMFDevSoundProxy::SetPrioritySettings |
|
1089 // Sets priority settings |
|
1090 // (other items were commented in a header). |
|
1091 // ----------------------------------------------------------------------------- |
|
1092 // |
|
1093 EXPORT_C void RMMFDevSoundProxy::SetPrioritySettings( |
|
1094 const TMMFPrioritySettings& aPrioritySettings) |
|
1095 { |
|
1096 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetPrioritySettings - Enter")); |
|
1097 TPckgBuf<TMMFPrioritySettings> prioritySet(aPrioritySettings); |
|
1098 SendReceive(EMMFDevSoundProxySetPrioritySettings, |
|
1099 iDestinationPckg, |
|
1100 prioritySet); |
|
1101 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetPrioritySettings - Exit")); |
|
1102 } |
|
1103 |
|
1104 // ----------------------------------------------------------------------------- |
|
1105 // RMMFDevSoundProxy::FixedSequenceName |
|
1106 // Returns the name of fixed sequence for a given sequence number. |
|
1107 // (other items were commented in a header). |
|
1108 // ----------------------------------------------------------------------------- |
|
1109 // |
|
1110 EXPORT_C const TDesC& RMMFDevSoundProxy::FixedSequenceName(TInt /*aSequenceNumber*/) |
|
1111 { |
|
1112 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::FixedSequenceName - Enter")); |
|
1113 _LIT(KNullDesC, ""); |
|
1114 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::FixedSequenceName - Exit")); |
|
1115 return KNullDesC; |
|
1116 } |
|
1117 |
|
1118 // ----------------------------------------------------------------------------- |
|
1119 // RMMFDevSoundProxy::CustomInterface |
|
1120 // Returns a pointer to CustomInterface object. |
|
1121 // (other items were commented in a header). |
|
1122 // ----------------------------------------------------------------------------- |
|
1123 // |
|
1124 EXPORT_C TAny* RMMFDevSoundProxy::CustomInterface(TUid aInterfaceId) |
|
1125 { |
|
1126 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomInterface - Enter")); |
|
1127 TMMFDevSoundProxySettings set; |
|
1128 set.iInterface = aInterfaceId; |
|
1129 // Added for ask for custom interface |
|
1130 TAny* customInterface = NULL; |
|
1131 if (aInterfaceId == KMmfUidDevSoundCancelInitializeCustomInterface) |
|
1132 { |
|
1133 MMMFDevSoundCancelInitialize* result = this; |
|
1134 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomInterface - Exit")); |
|
1135 return result; |
|
1136 } |
|
1137 TPckgBuf<TAny*> pckg2(customInterface); |
|
1138 |
|
1139 TMMFDevSoundProxySettingsPckg pckg(set); |
|
1140 SendReceiveResult(EMMFDevSoundProxyCustomInterface, |
|
1141 iDestinationPckg, |
|
1142 pckg, pckg2); |
|
1143 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomInterface - Exit")); |
|
1144 return reinterpret_cast<TAny*> (customInterface); |
|
1145 } |
|
1146 |
|
1147 // ----------------------------------------------------------------------------- |
|
1148 // RMMFDevSoundProxy::FixedSequenceCount |
|
1149 // Returns the number of fixed sequences supported by DevSound. |
|
1150 // (other items were commented in a header). |
|
1151 // ----------------------------------------------------------------------------- |
|
1152 // |
|
1153 EXPORT_C TInt RMMFDevSoundProxy::FixedSequenceCount() |
|
1154 { |
|
1155 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::FixedSequenceCount - Enter")); |
|
1156 TPckgBuf<TInt> fixSeqCountPckg; |
|
1157 SendReceiveResult(EMMFDevSoundProxyFixedSequenceCount, |
|
1158 iDestinationPckg, |
|
1159 KNullDesC8, |
|
1160 fixSeqCountPckg); |
|
1161 |
|
1162 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::FixedSequenceCount - Exit")); |
|
1163 return fixSeqCountPckg(); |
|
1164 } |
|
1165 |
|
1166 // ----------------------------------------------------------------------------- |
|
1167 // RMMFDevSoundProxy::BufferToBeFilledData |
|
1168 // Returns data buffer for playback. |
|
1169 // ----------------------------------------------------------------------------- |
|
1170 // |
|
1171 EXPORT_C TInt RMMFDevSoundProxy::BufferToBeFilledData( |
|
1172 TBool aRequestChunk, TMMFDevSoundProxyHwBufPckg& aSetPckg) |
|
1173 { |
|
1174 //SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::BufferToBeFilledData - Enter")); //Uncommenting this will produce a lot of logging! |
|
1175 // Note that there will only ever be one of these requests outstanding |
|
1176 // per session |
|
1177 TPckgBuf<TInt> requestChunkBuf (aRequestChunk); |
|
1178 TInt err = SendReceiveResult(EMMFDevSoundProxyBTBFData, |
|
1179 iDestinationPckg, |
|
1180 requestChunkBuf, |
|
1181 aSetPckg); |
|
1182 //SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::BufferToBeFilledData - Exit [%d]"), err); //Uncommenting this will produce a lot of logging! |
|
1183 return err; |
|
1184 } |
|
1185 |
|
1186 // ----------------------------------------------------------------------------- |
|
1187 // RMMFDevSoundProxy::BufferToBeEmptiedData |
|
1188 // Returns data buffer for recording. |
|
1189 // ----------------------------------------------------------------------------- |
|
1190 // |
|
1191 EXPORT_C TInt RMMFDevSoundProxy::BufferToBeEmptiedData( |
|
1192 TMMFDevSoundProxyHwBufPckg& aSetPckg) |
|
1193 { |
|
1194 //SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::BufferToBeEmptiedData - Enter")); //Uncommenting this will produce a lot of logging! |
|
1195 // Note that there will only ever be one of these requests outstanding |
|
1196 // per session |
|
1197 TInt err = SendReceiveResult(EMMFDevSoundProxyBTBEData, |
|
1198 iDestinationPckg, |
|
1199 KNullDesC8, |
|
1200 aSetPckg); |
|
1201 //SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::BufferToBeEmptiedData - Exit [%d]"), err); //Uncommenting this will produce a lot of logging! |
|
1202 return err; |
|
1203 } |
|
1204 |
|
1205 // ----------------------------------------------------------------------------- |
|
1206 // RMMFDevSoundProxy::RegisterAsClient |
|
1207 // Registers the client for notification of resource avalibility. |
|
1208 // ----------------------------------------------------------------------------- |
|
1209 // |
|
1210 EXPORT_C TInt RMMFDevSoundProxy::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData) |
|
1211 { |
|
1212 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RegisterAsClient - Enter")); |
|
1213 TMMFDevSoundProxySettings set; |
|
1214 set.iNotificationEventUid = aEventType; |
|
1215 TMMFDevSoundProxySettingsPckg pckg(set); |
|
1216 TInt err = SendReceive(EMMFDevSoundProxyRequestResourceNotification, iDestinationPckg, pckg, aNotificationRegistrationData); |
|
1217 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::RegisterAsClient - Exit [%d]"), err); |
|
1218 return err; |
|
1219 } |
|
1220 |
|
1221 // ----------------------------------------------------------------------------- |
|
1222 // RMMFDevSoundProxy::CancelRegisterAsClient |
|
1223 // Cancels the Registered Notification. |
|
1224 // ----------------------------------------------------------------------------- |
|
1225 // |
|
1226 EXPORT_C TInt RMMFDevSoundProxy::CancelRegisterAsClient(TUid aEventType) |
|
1227 { |
|
1228 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CancelRegisterAsClient - Enter")); |
|
1229 TMMFDevSoundProxySettings set; |
|
1230 set.iNotificationEventUid = aEventType; |
|
1231 TMMFDevSoundProxySettingsPckg pckg(set); |
|
1232 TInt err = SendReceiveResult(EMMFDevSoundProxyCancelRequestResourceNotification, iDestinationPckg, KNullDesC8, pckg); |
|
1233 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::CancelRegisterAsClient - Exit [%d]"), err); |
|
1234 return err; |
|
1235 } |
|
1236 |
|
1237 // ----------------------------------------------------------------------------- |
|
1238 // RMMFDevSoundProxy::GetResourceNotificationData |
|
1239 // Returns the Notification data which the client needs to resume playing. |
|
1240 // ----------------------------------------------------------------------------- |
|
1241 // |
|
1242 EXPORT_C TInt RMMFDevSoundProxy::GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData) |
|
1243 { |
|
1244 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetResourceNotificationData - Enter")); |
|
1245 TMMFDevSoundProxySettings set; |
|
1246 set.iNotificationEventUid = aEventType; |
|
1247 TMMFDevSoundProxySettingsPckg pckg(set); |
|
1248 TInt err = SendReceiveResult(EMMFDevSoundProxyGetResourceNotificationData, iDestinationPckg, pckg, aNotificationData); |
|
1249 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::GetResourceNotificationData - Exit [%d]"), err); |
|
1250 return err; |
|
1251 } |
|
1252 |
|
1253 // ----------------------------------------------------------------------------- |
|
1254 // RMMFDevSoundProxy::WillResumePlay |
|
1255 // Wait for the clients to resume play back even after the default timeout |
|
1256 // expires. Unless the client cancels the notification request or completes |
|
1257 // no other client gets notification. |
|
1258 // ----------------------------------------------------------------------------- |
|
1259 // |
|
1260 EXPORT_C TInt RMMFDevSoundProxy::WillResumePlay() |
|
1261 { |
|
1262 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::WillResumePlay - Enter")); |
|
1263 TInt err = SendReceive(EMMFDevSoundProxyWillResumePlay, iDestinationPckg); |
|
1264 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::WillResumePlay - Exit [%d]"), err); |
|
1265 return err; |
|
1266 } |
|
1267 |
|
1268 // ----------------------------------------------------------------------------- |
|
1269 // RMMFDevSoundProxy::EmptyBuffers |
|
1270 // Empties the play buffers below DevSound without causing the codec |
|
1271 // to be deleted. |
|
1272 // ----------------------------------------------------------------------------- |
|
1273 // |
|
1274 |
|
1275 EXPORT_C TInt RMMFDevSoundProxy::EmptyBuffers() |
|
1276 { |
|
1277 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::EmptyBuffers - Enter")); |
|
1278 TInt error = SendReceive(EMMFDevSoundProxyEmptyBuffers, iDestinationPckg); |
|
1279 |
|
1280 if(error==KErrNone) |
|
1281 { |
|
1282 if (iState==EPlayingBufferWait) |
|
1283 { |
|
1284 // Empty buffers terminates the buffer cycle |
|
1285 iState = EPlaying; |
|
1286 } |
|
1287 } |
|
1288 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::EmptyBuffers - Exit [%d]"), error); |
|
1289 return error; |
|
1290 } |
|
1291 |
|
1292 // ----------------------------------------------------------------------------- |
|
1293 // RMMFDevSoundProxy::CancelInitialize |
|
1294 // Cancels the initialization process |
|
1295 // ----------------------------------------------------------------------------- |
|
1296 // |
|
1297 EXPORT_C TInt RMMFDevSoundProxy::CancelInitialize() |
|
1298 { |
|
1299 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CancelInitialize - Enter")); |
|
1300 TInt err=KErrNone; |
|
1301 |
|
1302 if (iState==EInitializing) |
|
1303 { |
|
1304 err = SendReceive(EMMFDevSoundProxyCancelInitialize, iDestinationPckg); |
|
1305 iState = EIdle; |
|
1306 } |
|
1307 else |
|
1308 { |
|
1309 err = KErrNotReady; |
|
1310 } |
|
1311 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::CancelInitialize - Exit [%d]"), err); |
|
1312 return err; |
|
1313 } |
|
1314 |
|
1315 |
|
1316 // ----------------------------------------------------------------------------- |
|
1317 // RMMFDevSoundProxy::SetClientThreadInfo |
|
1318 // |
|
1319 // ----------------------------------------------------------------------------- |
|
1320 // |
|
1321 EXPORT_C TInt RMMFDevSoundProxy::SetClientThreadInfo(TThreadId& aTid) |
|
1322 { |
|
1323 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetClientThreadInfo - Enter")); |
|
1324 TPckgBuf<TThreadId> threadId(aTid); |
|
1325 TInt err = SendReceive(EMMFDevSoundProxySetClientThreadInfo, iDestinationPckg, threadId); |
|
1326 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::SetClientThreadInfo - Exit [%d]"), err); |
|
1327 return err; |
|
1328 } |
|
1329 |
|
1330 |
|
1331 // ----------------------------------------------------------------------------- |
|
1332 // RMMFDevSoundProxy::CustomCommandSync() |
|
1333 // Send Message synchronously to DevSound server and return the result to client |
|
1334 // ----------------------------------------------------------------------------- |
|
1335 // |
|
1336 EXPORT_C TInt RMMFDevSoundProxy::CustomCommandSync( |
|
1337 const TMMFMessageDestinationPckg& aDestination, |
|
1338 TInt aFunction, |
|
1339 const TDesC8& aDataTo1, |
|
1340 const TDesC8& aDataTo2, |
|
1341 TDes8& aDataFrom) |
|
1342 { |
|
1343 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandSync - Enter")); |
|
1344 TInt err = SendReceiveResult(aFunction, |
|
1345 aDestination, |
|
1346 aDataTo1, |
|
1347 aDataTo2, |
|
1348 aDataFrom); |
|
1349 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::CustomCommandSync - Exit [%d]"), err); |
|
1350 return err; |
|
1351 } |
|
1352 |
|
1353 // ----------------------------------------------------------------------------- |
|
1354 // RMMFDevSoundProxy::RMMFDevSoundProxy() |
|
1355 // Send Message synchronously to DevSound server and return the result to client |
|
1356 // ----------------------------------------------------------------------------- |
|
1357 // |
|
1358 EXPORT_C TInt RMMFDevSoundProxy::CustomCommandSync( |
|
1359 const TMMFMessageDestinationPckg& aDestination, |
|
1360 TInt aFunction, |
|
1361 const TDesC8& aDataTo1, |
|
1362 const TDesC8& aDataTo2) |
|
1363 { |
|
1364 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandSync - Enter")); |
|
1365 TInt err = SendReceive(aFunction, aDestination, aDataTo1, aDataTo2); |
|
1366 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::CustomCommandSync - Exit [%d]"), err); |
|
1367 return err; |
|
1368 } |
|
1369 |
|
1370 // ----------------------------------------------------------------------------- |
|
1371 // RMMFDevSoundProxy::RMMFDevSoundProxy() |
|
1372 // Send Message asynchronously to DevSound server |
|
1373 // ----------------------------------------------------------------------------- |
|
1374 // |
|
1375 EXPORT_C void RMMFDevSoundProxy::CustomCommandAsync( |
|
1376 const TMMFMessageDestinationPckg& aDestination, |
|
1377 TInt aFunction, |
|
1378 const TDesC8& aDataTo1, |
|
1379 const TDesC8& aDataTo2, |
|
1380 TDes8& aDataFrom, |
|
1381 TRequestStatus& aStatus ) |
|
1382 { |
|
1383 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandAsync - Enter")); |
|
1384 SendReceiveResult(aFunction, |
|
1385 aDestination, |
|
1386 aDataTo1, |
|
1387 aDataTo2, |
|
1388 aDataFrom, |
|
1389 aStatus); |
|
1390 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandAsync - Exit")); |
|
1391 } |
|
1392 |
|
1393 // ----------------------------------------------------------------------------- |
|
1394 // RMMFDevSoundProxy::RMMFDevSoundProxy() |
|
1395 // Send Message asynchronously to DevSound server |
|
1396 // ----------------------------------------------------------------------------- |
|
1397 // |
|
1398 EXPORT_C void RMMFDevSoundProxy::CustomCommandAsync( |
|
1399 const TMMFMessageDestinationPckg& aDestination, |
|
1400 TInt aFunction, |
|
1401 const TDesC8& aDataTo1, |
|
1402 const TDesC8& aDataTo2, |
|
1403 TRequestStatus& aStatus ) |
|
1404 { |
|
1405 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandAsync - Enter")); |
|
1406 SendReceive(aFunction, aDestination, aDataTo1, aDataTo2, aStatus); |
|
1407 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandAsync - Exit")); |
|
1408 } |
|
1409 |
|
1410 // implementation of a simple CustomCommand() scheme |
|
1411 EXPORT_C TInt RMMFDevSoundProxy::SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam) |
|
1412 { |
|
1413 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SyncCustomCommand - Enter")); |
|
1414 TMMFMessageDestinationPckg dest(TMMFMessageDestination(aUid, KMMFObjectHandleDevSound)); |
|
1415 |
|
1416 TInt err = KErrNone; |
|
1417 if (aOutParam==NULL) |
|
1418 { |
|
1419 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SyncCustomCommand - Exit")); |
|
1420 err = SendReceive(EMMFDevSoundProxySyncCustomCommand, dest, aParam1, aParam2); |
|
1421 return err; |
|
1422 } |
|
1423 else |
|
1424 { |
|
1425 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SyncCustomCommand - Exit")); |
|
1426 err = SendReceiveResult(EMMFDevSoundProxySyncCustomCommandResult, dest, aParam1, aParam2, *aOutParam); |
|
1427 return err; |
|
1428 } |
|
1429 } |
|
1430 |
|
1431 EXPORT_C void RMMFDevSoundProxy::AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam) |
|
1432 { |
|
1433 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::AsyncCustomCommand - Enter")); |
|
1434 TMMFMessageDestination dest(aUid, KMMFObjectHandleDevSound); |
|
1435 iCustIntPckg = dest; |
|
1436 if (aOutParam==NULL) |
|
1437 { |
|
1438 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::AsyncCustomCommand - Exit")); |
|
1439 SendReceive(EMMFDevSoundProxyAsyncCustomCommand, iCustIntPckg, aParam1, aParam2, aStatus); |
|
1440 } |
|
1441 else |
|
1442 { |
|
1443 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::AsyncCustomCommand - Exit")); |
|
1444 SendReceiveResult(EMMFDevSoundProxyAsyncCustomCommandResult, iCustIntPckg, aParam1, aParam2, *aOutParam, aStatus); |
|
1445 } |
|
1446 } |
|
1447 |
|
1448 EXPORT_C TInt RMMFDevSoundProxy::GetTimePlayed(TTimeIntervalMicroSeconds& aTime) |
|
1449 { |
|
1450 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetTimePlayed - Enter")); |
|
1451 TTimeIntervalMicroSeconds time(0); |
|
1452 TPckgBuf<TTimeIntervalMicroSeconds> timePckg(time); |
|
1453 TInt err = SendReceiveResult(EMMFDevSoundProxyGetTimePlayed, iDestinationPckg, KNullDesC8, timePckg); |
|
1454 if(err==KErrNone) |
|
1455 { |
|
1456 aTime = timePckg(); |
|
1457 } |
|
1458 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::GetTimePlayed - Exit [%d]"), err); |
|
1459 return err; |
|
1460 } |
|
1461 |
|
1462 EXPORT_C TBool RMMFDevSoundProxy::IsResumeSupported() |
|
1463 { |
|
1464 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::IsResumeSupported - Enter")); |
|
1465 TPckgBuf<TBool> isResumeSupported; |
|
1466 TInt err = SendReceiveResult(EMMFDevSoundProxyIsResumeSupported, |
|
1467 iDestinationPckg, |
|
1468 KNullDesC8, |
|
1469 isResumeSupported); |
|
1470 if(err == KErrNone) |
|
1471 { |
|
1472 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::IsResumeSupported - Exit")); |
|
1473 return isResumeSupported(); |
|
1474 } |
|
1475 else |
|
1476 { |
|
1477 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::IsResumeSupported - Exit")); |
|
1478 return EFalse; |
|
1479 } |
|
1480 } |
|
1481 |
|
1482 EXPORT_C TInt RMMFDevSoundProxy::Resume() |
|
1483 { |
|
1484 SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Resume - Enter")); |
|
1485 TInt err = KErrNone; |
|
1486 if (!iDevSoundObserver || iState <= EInitialized ) |
|
1487 { |
|
1488 err = KErrNotReady; |
|
1489 } |
|
1490 else if(iState == ETonePlaying && iToneMode != ESequence) |
|
1491 { |
|
1492 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::Resume - Exit [%d]"), err); |
|
1493 return KErrNotSupported; |
|
1494 } |
|
1495 else |
|
1496 { |
|
1497 if (iState==ERecordingInLastBufferCycle) |
|
1498 { |
|
1499 // if we're in a last buffer cycle and get Resume() we have to be careful as the |
|
1500 // server side sent a PausedRecordCompleteEvent and did not actually request a buffer! |
|
1501 // just record the fact we've done this and wait until RecordData() is called |
|
1502 // don't actually resume until then! |
|
1503 iState = ERecordingResumingInLastBufferCycle; |
|
1504 } |
|
1505 else if (iState == ERecordingResumingInLastBufferCycle) |
|
1506 { |
|
1507 //Do Nothing as you can't resume twice on last buffer |
|
1508 } |
|
1509 else |
|
1510 { |
|
1511 err = SendReceive(EMMFDevSoundProxyResume, |
|
1512 iDestinationPckg); |
|
1513 } |
|
1514 } |
|
1515 SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::Resume - Exit [%d]"), err); |
|
1516 return err; |
|
1517 } |
|
1518 |
|
1519 // ----------------------------------------------------------------------------- |
|
1520 // RMMFDevSoundProxy::StartReceivingMsgQueueHandlerEventsL() |
|
1521 // Starts message queue handler (A/O) to monitor client side events |
|
1522 // ----------------------------------------------------------------------------- |
|
1523 // |
|
1524 void RMMFDevSoundProxy::StartReceivingMsgQueueHandlerEventsL(MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver) |
|
1525 { |
|
1526 if (iMsgQueueHandler) |
|
1527 { |
|
1528 iMsgQueueHandler->Cancel(); |
|
1529 } |
|
1530 else |
|
1531 { |
|
1532 iMsgQueueHandler = CMsgQueueHandler::NewL(this, |
|
1533 *this, |
|
1534 &iMsgQueue, |
|
1535 aDevSoundCIObserver); |
|
1536 } |
|
1537 |
|
1538 iMsgQueueHandler->ReceiveEvents(); |
|
1539 } |
|
1540 |
|
1541 // MDevSoundObserver |
|
1542 // intercept the calls from the msgQueueHandler going back to the client, so we can track real state |
|
1543 |
|
1544 void RMMFDevSoundProxy::InitializeComplete(TInt aError) |
|
1545 { |
|
1546 SYMBIAN_CHECK(iState==EInitializing, Panic(EMMFDevSoundProxyInitCompleteInWrongState)); |
|
1547 if (aError==KErrNone) |
|
1548 { |
|
1549 iState = EInitialized; |
|
1550 } |
|
1551 else |
|
1552 { |
|
1553 iState = EIdle; |
|
1554 } |
|
1555 iDevSoundObserver->InitializeComplete(aError); |
|
1556 } |
|
1557 |
|
1558 void RMMFDevSoundProxy::ToneFinished(TInt aError) |
|
1559 { |
|
1560 SYMBIAN_CHECK(iState==ETonePlaying, Panic(EMMFDevSoundProxyToneFinishedInWrongState)); |
|
1561 iState = EInitialized; |
|
1562 iDevSoundObserver->ToneFinished(aError); |
|
1563 } |
|
1564 |
|
1565 void RMMFDevSoundProxy::PlayError(TInt aError) |
|
1566 { |
|
1567 SYMBIAN_CHECK(iState==EPlaying||iState==EPlayingBufferWait, Panic(EMMFDevSoundProxyPlayErrorInWrongState)); |
|
1568 iState = EInitialized; |
|
1569 iDevSoundObserver->PlayError(aError); |
|
1570 } |
|
1571 |
|
1572 void RMMFDevSoundProxy::RecordError(TInt aError) |
|
1573 { |
|
1574 SYMBIAN_CHECK(iState==ERecording||iState==ERecordingBufferWait, Panic(EMMFDevSoundProxyRecordErrorInWrongState)); |
|
1575 iState = EInitialized; |
|
1576 iDevSoundObserver->RecordError(aError); |
|
1577 } |
|
1578 |
|
1579 void RMMFDevSoundProxy::BufferToBeFilled(CMMFBuffer* aBuffer) |
|
1580 { |
|
1581 SYMBIAN_CHECK(iState==EPlaying, Panic(EMMFDevSoundProxyBTBFInWrongState)); |
|
1582 iState = EPlayingBufferWait; |
|
1583 iBuffer = static_cast<CMMFDataBuffer*>(aBuffer); // cache buffer for use in PlayData() later |
|
1584 iDevSoundObserver->BufferToBeFilled(aBuffer); |
|
1585 } |
|
1586 |
|
1587 void RMMFDevSoundProxy::BufferToBeEmptied(CMMFBuffer* aBuffer) |
|
1588 { |
|
1589 SYMBIAN_CHECK(iState==ERecording, Panic(EMMFDevSoundProxyBTBEInWrongState)); |
|
1590 if (aBuffer->LastBuffer()) |
|
1591 { |
|
1592 // this is end of recording. Assume have an empty buffer. Different state so that Resume() is handled as special case. |
|
1593 iState = ERecordingInLastBufferCycle; |
|
1594 } |
|
1595 else |
|
1596 { |
|
1597 iState = ERecordingBufferWait; |
|
1598 } |
|
1599 iDevSoundObserver->BufferToBeEmptied(aBuffer); |
|
1600 } |
|
1601 |
|
1602 void RMMFDevSoundProxy::ConvertError(TInt /*aError*/) |
|
1603 { |
|
1604 SYMBIAN_CHECK(EFalse, Panic(EMMFDevSoundProxyUnexpectedConvError)); |
|
1605 } |
|
1606 |
|
1607 void RMMFDevSoundProxy::DeviceMessage(TUid aMessageType, const TDesC8& aMsg) |
|
1608 { |
|
1609 iDevSoundObserver->DeviceMessage(aMessageType, aMsg); |
|
1610 } |
|
1611 |
|
1612 void RMMFDevSoundProxy::SendEventToClient(const TMMFEvent& aEvent) |
|
1613 { |
|
1614 iDevSoundObserver->SendEventToClient(aEvent); |
|
1615 } |
|
1616 |
|
1617 |
|
1618 // End of File |