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