sl@0
|
1 |
// Copyright (c) 2004-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 |
#include <f32file.h>
|
sl@0
|
17 |
#include <e32math.h>
|
sl@0
|
18 |
#include <s32mem.h>
|
sl@0
|
19 |
#include "MmfDevSoundProxy.h"
|
sl@0
|
20 |
#include "MmfDevSoundServerStart.h"
|
sl@0
|
21 |
#include "MmfBase.hrh"
|
sl@0
|
22 |
#include "MmfAudioClientServer.h"
|
sl@0
|
23 |
#include <mmf/plugin/mmfdevsoundcustominterface.hrh>
|
sl@0
|
24 |
#include <ecom/ecom.h>
|
sl@0
|
25 |
|
sl@0
|
26 |
|
sl@0
|
27 |
/**
|
sl@0
|
28 |
@internalTechnology
|
sl@0
|
29 |
|
sl@0
|
30 |
This function raises a panic
|
sl@0
|
31 |
|
sl@0
|
32 |
@param aError
|
sl@0
|
33 |
one of the several panic codes that may be raised by this dll
|
sl@0
|
34 |
|
sl@0
|
35 |
@panic EMMFDevSoundProxyPlayDataWithoutInitialize is raised when playdata is called without initialization
|
sl@0
|
36 |
@panic EMMFDevSoundProxyRecordDataWithoutInitialize is raised when recorddata is called without initialization
|
sl@0
|
37 |
@panic EMMFDevSoundProxyConvertDataWithoutInitialize is raised when convertdata is called without initialization
|
sl@0
|
38 |
*/
|
sl@0
|
39 |
GLDEF_C void Panic(TMMFDevSoundProxyPanicCodes aPanicCode)
|
sl@0
|
40 |
{
|
sl@0
|
41 |
User::Panic(KMMFDevSoundProxyPanicCategory, aPanicCode);
|
sl@0
|
42 |
}
|
sl@0
|
43 |
|
sl@0
|
44 |
EXPORT_C RMMFDevSoundProxy::RMMFDevSoundProxy()
|
sl@0
|
45 |
: iBuffer(NULL), iSeqName(NULL), iMsgQueueHandle(NULL), iAudioServerProxy (NULL)
|
sl@0
|
46 |
{
|
sl@0
|
47 |
}
|
sl@0
|
48 |
|
sl@0
|
49 |
EXPORT_C void RMMFDevSoundProxy::Close()
|
sl@0
|
50 |
{
|
sl@0
|
51 |
RMmfSessionBase::Close();
|
sl@0
|
52 |
iState = EIdle;
|
sl@0
|
53 |
if(iAudioServerProxy)
|
sl@0
|
54 |
{
|
sl@0
|
55 |
iAudioServerProxy->Close();
|
sl@0
|
56 |
delete iAudioServerProxy;
|
sl@0
|
57 |
}
|
sl@0
|
58 |
delete iBuffer;
|
sl@0
|
59 |
delete iSeqName;
|
sl@0
|
60 |
}
|
sl@0
|
61 |
|
sl@0
|
62 |
EXPORT_C TInt RMMFDevSoundProxy::Open(RHandleBase& aMsgQueueHandle)
|
sl@0
|
63 |
{
|
sl@0
|
64 |
TInt err = KErrNone;
|
sl@0
|
65 |
iMsgQueueHandle = &aMsgQueueHandle;
|
sl@0
|
66 |
TRAP(err, iSeqName = HBufC::NewL(KMaxFixedSequenceNameLength));
|
sl@0
|
67 |
if(err == KErrNone)
|
sl@0
|
68 |
{
|
sl@0
|
69 |
TRAP(err, iAudioServerProxy = new (ELeave) RMMFAudioServerProxy());
|
sl@0
|
70 |
if(err == KErrNone)
|
sl@0
|
71 |
{
|
sl@0
|
72 |
err = iAudioServerProxy->Open();
|
sl@0
|
73 |
if(err == KErrNone)
|
sl@0
|
74 |
{
|
sl@0
|
75 |
err = SetReturnedHandle(iAudioServerProxy->GetDevSoundSessionHandle());
|
sl@0
|
76 |
}
|
sl@0
|
77 |
}
|
sl@0
|
78 |
}
|
sl@0
|
79 |
if(err)
|
sl@0
|
80 |
{
|
sl@0
|
81 |
Close();
|
sl@0
|
82 |
}
|
sl@0
|
83 |
|
sl@0
|
84 |
return err;
|
sl@0
|
85 |
}
|
sl@0
|
86 |
EXPORT_C TInt RMMFDevSoundProxy::SetDevSoundInfo()
|
sl@0
|
87 |
{
|
sl@0
|
88 |
return SendReceive(EMMFAudioLaunchRequests);
|
sl@0
|
89 |
}
|
sl@0
|
90 |
|
sl@0
|
91 |
EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TMMFState aMode)
|
sl@0
|
92 |
{
|
sl@0
|
93 |
TMMFDevSoundProxySettings set;
|
sl@0
|
94 |
set.iMode = aMode;
|
sl@0
|
95 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
96 |
TIpcArgs args(&pckg, *iMsgQueueHandle);
|
sl@0
|
97 |
return RSessionBase::SendReceive(EMMFDevSoundProxyInitialize1, args);
|
sl@0
|
98 |
}
|
sl@0
|
99 |
|
sl@0
|
100 |
EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TUid aHWDev, TMMFState aMode)
|
sl@0
|
101 |
{
|
sl@0
|
102 |
TMMFDevSoundProxySettings set;
|
sl@0
|
103 |
set.iHWDev = aHWDev;
|
sl@0
|
104 |
set.iMode = aMode;
|
sl@0
|
105 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
106 |
TIpcArgs args(&pckg, *iMsgQueueHandle);
|
sl@0
|
107 |
return RSessionBase::SendReceive(EMMFDevSoundProxyInitialize2, args);
|
sl@0
|
108 |
}
|
sl@0
|
109 |
|
sl@0
|
110 |
EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TFourCC aDesiredFourCC, TMMFState aMode)
|
sl@0
|
111 |
{
|
sl@0
|
112 |
TMMFDevSoundProxySettings set;
|
sl@0
|
113 |
set.iDesiredFourCC = aDesiredFourCC;
|
sl@0
|
114 |
set.iMode = aMode;
|
sl@0
|
115 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
116 |
TIpcArgs args(&pckg, *iMsgQueueHandle);
|
sl@0
|
117 |
return RSessionBase::SendReceive(EMMFDevSoundProxyInitialize4, args);
|
sl@0
|
118 |
}
|
sl@0
|
119 |
|
sl@0
|
120 |
EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Capabilities()
|
sl@0
|
121 |
{
|
sl@0
|
122 |
TMMFDevSoundProxySettings set;
|
sl@0
|
123 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
124 |
SendReceiveResult(EMMFDevSoundProxyCapabilities,KNullDesC8,KNullDesC8,pckg);
|
sl@0
|
125 |
return pckg().iCaps;
|
sl@0
|
126 |
}
|
sl@0
|
127 |
|
sl@0
|
128 |
EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Config()
|
sl@0
|
129 |
{
|
sl@0
|
130 |
TMMFDevSoundProxySettings set;
|
sl@0
|
131 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
132 |
SendReceiveResult(EMMFDevSoundProxyConfig,KNullDesC8,KNullDesC8,pckg);
|
sl@0
|
133 |
return pckg().iConfig;
|
sl@0
|
134 |
}
|
sl@0
|
135 |
|
sl@0
|
136 |
EXPORT_C TInt RMMFDevSoundProxy::SetConfigL(const TMMFCapabilities& aConfig)
|
sl@0
|
137 |
{
|
sl@0
|
138 |
TMMFDevSoundProxySettings set;
|
sl@0
|
139 |
set.iConfig = aConfig;
|
sl@0
|
140 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
141 |
TInt err = SendReceive(EMMFDevSoundProxySetConfig, pckg);
|
sl@0
|
142 |
User::LeaveIfError(err);
|
sl@0
|
143 |
return err;
|
sl@0
|
144 |
}
|
sl@0
|
145 |
|
sl@0
|
146 |
EXPORT_C TInt RMMFDevSoundProxy::MaxVolume()
|
sl@0
|
147 |
{
|
sl@0
|
148 |
TMMFDevSoundProxySettings set;
|
sl@0
|
149 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
150 |
SendReceiveResult(EMMFDevSoundProxyMaxVolume,KNullDesC8,KNullDesC8,pckg);
|
sl@0
|
151 |
return pckg().iMaxVolume;
|
sl@0
|
152 |
}
|
sl@0
|
153 |
|
sl@0
|
154 |
EXPORT_C TInt RMMFDevSoundProxy::Volume()
|
sl@0
|
155 |
{
|
sl@0
|
156 |
TMMFDevSoundProxySettings set;
|
sl@0
|
157 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
158 |
SendReceiveResult(EMMFDevSoundProxyVolume,KNullDesC8,KNullDesC8,pckg);
|
sl@0
|
159 |
return pckg().iVolume;
|
sl@0
|
160 |
}
|
sl@0
|
161 |
|
sl@0
|
162 |
EXPORT_C TInt RMMFDevSoundProxy::SetVolume(TInt aVolume)
|
sl@0
|
163 |
{
|
sl@0
|
164 |
TMMFDevSoundProxySettings set;
|
sl@0
|
165 |
set.iVolume = aVolume;
|
sl@0
|
166 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
167 |
return SendReceive(EMMFDevSoundProxySetVolume, pckg);
|
sl@0
|
168 |
}
|
sl@0
|
169 |
|
sl@0
|
170 |
EXPORT_C TInt RMMFDevSoundProxy::MaxGain()
|
sl@0
|
171 |
{
|
sl@0
|
172 |
TMMFDevSoundProxySettings set;
|
sl@0
|
173 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
174 |
SendReceiveResult(EMMFDevSoundProxyMaxGain,KNullDesC8,KNullDesC8,pckg);
|
sl@0
|
175 |
return pckg().iMaxGain;
|
sl@0
|
176 |
}
|
sl@0
|
177 |
|
sl@0
|
178 |
EXPORT_C TInt RMMFDevSoundProxy::Gain()
|
sl@0
|
179 |
{
|
sl@0
|
180 |
TMMFDevSoundProxySettings set;
|
sl@0
|
181 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
182 |
SendReceiveResult(EMMFDevSoundProxyGain,KNullDesC8,KNullDesC8,pckg);
|
sl@0
|
183 |
return pckg().iGain;
|
sl@0
|
184 |
}
|
sl@0
|
185 |
|
sl@0
|
186 |
EXPORT_C TInt RMMFDevSoundProxy::SetGain(TInt aGain)
|
sl@0
|
187 |
{
|
sl@0
|
188 |
TMMFDevSoundProxySettings set;
|
sl@0
|
189 |
set.iGain = aGain;
|
sl@0
|
190 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
191 |
return SendReceive(EMMFDevSoundProxySetGain, pckg);
|
sl@0
|
192 |
}
|
sl@0
|
193 |
|
sl@0
|
194 |
EXPORT_C void RMMFDevSoundProxy::GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage)
|
sl@0
|
195 |
{
|
sl@0
|
196 |
TMMFDevSoundProxySettings set;
|
sl@0
|
197 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
198 |
User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyPlayBalance,KNullDesC8,KNullDesC8,pckg));
|
sl@0
|
199 |
aLeftPercentage = pckg().iLeftPercentage;
|
sl@0
|
200 |
aRightPercentage = pckg().iRightPercentage;
|
sl@0
|
201 |
}
|
sl@0
|
202 |
|
sl@0
|
203 |
EXPORT_C void RMMFDevSoundProxy::SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage)
|
sl@0
|
204 |
{
|
sl@0
|
205 |
TMMFDevSoundProxySettings set;
|
sl@0
|
206 |
set.iLeftPercentage = aLeftPercentage;
|
sl@0
|
207 |
set.iRightPercentage = aRightPercentage;
|
sl@0
|
208 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
209 |
User::LeaveIfError(SendReceive(EMMFDevSoundProxySetPlayBalance, pckg));
|
sl@0
|
210 |
}
|
sl@0
|
211 |
|
sl@0
|
212 |
EXPORT_C void RMMFDevSoundProxy::GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage)
|
sl@0
|
213 |
{
|
sl@0
|
214 |
TMMFDevSoundProxySettings set;
|
sl@0
|
215 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
216 |
User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyRecordBalance,KNullDesC8,KNullDesC8,pckg));
|
sl@0
|
217 |
aLeftPercentage = pckg().iLeftPercentage;
|
sl@0
|
218 |
aRightPercentage = pckg().iRightPercentage;
|
sl@0
|
219 |
}
|
sl@0
|
220 |
|
sl@0
|
221 |
EXPORT_C void RMMFDevSoundProxy::SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage)
|
sl@0
|
222 |
{
|
sl@0
|
223 |
TMMFDevSoundProxySettings set;
|
sl@0
|
224 |
set.iLeftPercentage = aLeftPercentage;
|
sl@0
|
225 |
set.iRightPercentage = aRightPercentage;
|
sl@0
|
226 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
227 |
User::LeaveIfError(SendReceive(EMMFDevSoundProxySetRecordBalance, pckg));
|
sl@0
|
228 |
}
|
sl@0
|
229 |
|
sl@0
|
230 |
EXPORT_C void RMMFDevSoundProxy::PlayInitL()
|
sl@0
|
231 |
{
|
sl@0
|
232 |
User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayInit));
|
sl@0
|
233 |
iState = EPlaying;
|
sl@0
|
234 |
}
|
sl@0
|
235 |
|
sl@0
|
236 |
EXPORT_C void RMMFDevSoundProxy::RecordInitL()
|
sl@0
|
237 |
{
|
sl@0
|
238 |
User::LeaveIfError(SendReceive(EMMFDevSoundProxyRecordInit));
|
sl@0
|
239 |
iState = ERecording;
|
sl@0
|
240 |
}
|
sl@0
|
241 |
|
sl@0
|
242 |
EXPORT_C void RMMFDevSoundProxy::PlayData()
|
sl@0
|
243 |
{
|
sl@0
|
244 |
__ASSERT_ALWAYS(iState == EPlaying, Panic(EMMFDevSoundProxyPlayDataWithoutInitialize));
|
sl@0
|
245 |
|
sl@0
|
246 |
TMMFDevSoundProxyHwBuf set;
|
sl@0
|
247 |
set.iLastBuffer = iBuffer->LastBuffer();
|
sl@0
|
248 |
TMMFDevSoundProxyHwBufPckg pckg(set);
|
sl@0
|
249 |
SendReceive(EMMFDevSoundProxyPlayData, pckg, iBuffer->Data());
|
sl@0
|
250 |
}
|
sl@0
|
251 |
|
sl@0
|
252 |
EXPORT_C void RMMFDevSoundProxy::RecordData()
|
sl@0
|
253 |
{
|
sl@0
|
254 |
__ASSERT_ALWAYS(iState == ERecording, Panic(EMMFDevSoundProxyRecordDataWithoutInitialize));
|
sl@0
|
255 |
SendReceive(EMMFDevSoundProxyRecordData);
|
sl@0
|
256 |
}
|
sl@0
|
257 |
|
sl@0
|
258 |
EXPORT_C void RMMFDevSoundProxy::Stop()
|
sl@0
|
259 |
{
|
sl@0
|
260 |
SendReceive(EMMFDevSoundProxyStop);
|
sl@0
|
261 |
iState = EIdle;
|
sl@0
|
262 |
}
|
sl@0
|
263 |
|
sl@0
|
264 |
EXPORT_C void RMMFDevSoundProxy::Pause()
|
sl@0
|
265 |
{
|
sl@0
|
266 |
SendReceive(EMMFDevSoundProxyPause);
|
sl@0
|
267 |
}
|
sl@0
|
268 |
|
sl@0
|
269 |
EXPORT_C void RMMFDevSoundProxy::PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration)
|
sl@0
|
270 |
{
|
sl@0
|
271 |
TMMFDevSoundProxySettings set;
|
sl@0
|
272 |
set.iFrequencyOne = aFrequency;
|
sl@0
|
273 |
set.iDuration = aDuration;
|
sl@0
|
274 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
275 |
User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayTone, pckg));
|
sl@0
|
276 |
}
|
sl@0
|
277 |
|
sl@0
|
278 |
EXPORT_C void RMMFDevSoundProxy::PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration)
|
sl@0
|
279 |
{
|
sl@0
|
280 |
TMMFDevSoundProxySettings set;
|
sl@0
|
281 |
set.iFrequencyOne = aFrequencyOne;
|
sl@0
|
282 |
set.iFrequencyTwo = aFrequencyTwo;
|
sl@0
|
283 |
set.iDuration = aDuration;
|
sl@0
|
284 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
285 |
User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayDualTone, pckg));
|
sl@0
|
286 |
}
|
sl@0
|
287 |
|
sl@0
|
288 |
EXPORT_C void RMMFDevSoundProxy::PlayDTMFStringL(const TDesC& aDTMFString)
|
sl@0
|
289 |
{
|
sl@0
|
290 |
User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayDTMFString, aDTMFString));
|
sl@0
|
291 |
}
|
sl@0
|
292 |
|
sl@0
|
293 |
EXPORT_C void RMMFDevSoundProxy::PlayToneSequenceL(const TDesC8& aData)
|
sl@0
|
294 |
{
|
sl@0
|
295 |
User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayToneSequence, aData));
|
sl@0
|
296 |
}
|
sl@0
|
297 |
|
sl@0
|
298 |
EXPORT_C void RMMFDevSoundProxy::PlayFixedSequenceL(TInt aSequenceNumber)
|
sl@0
|
299 |
{
|
sl@0
|
300 |
TPckgBuf<TInt> seqNum(aSequenceNumber);
|
sl@0
|
301 |
User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayFixedSequence, seqNum));
|
sl@0
|
302 |
}
|
sl@0
|
303 |
|
sl@0
|
304 |
EXPORT_C void RMMFDevSoundProxy::SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength,
|
sl@0
|
305 |
TTimeIntervalMicroSeconds32& aToneOffLength,
|
sl@0
|
306 |
TTimeIntervalMicroSeconds32& aPauseLength)
|
sl@0
|
307 |
{
|
sl@0
|
308 |
TMMFDevSoundProxySettings set;
|
sl@0
|
309 |
set.iToneOnLength = aToneOnLength;
|
sl@0
|
310 |
set.iToneOffLength = aToneOffLength;
|
sl@0
|
311 |
set.iPauseLength = aPauseLength;
|
sl@0
|
312 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
313 |
SendReceive(EMMFDevSoundProxySetDTMFLengths, pckg);
|
sl@0
|
314 |
}
|
sl@0
|
315 |
|
sl@0
|
316 |
EXPORT_C void RMMFDevSoundProxy::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration)
|
sl@0
|
317 |
{
|
sl@0
|
318 |
TMMFDevSoundProxySettings set;
|
sl@0
|
319 |
set.iDuration = aRampDuration;
|
sl@0
|
320 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
321 |
SendReceive(EMMFDevSoundProxySetVolumeRamp, pckg);
|
sl@0
|
322 |
}
|
sl@0
|
323 |
|
sl@0
|
324 |
EXPORT_C void RMMFDevSoundProxy::GetSupportedInputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings)
|
sl@0
|
325 |
{
|
sl@0
|
326 |
aSupportedDataTypes.Reset();
|
sl@0
|
327 |
|
sl@0
|
328 |
TMMFPrioritySettings prioritySet = aPrioritySettings;
|
sl@0
|
329 |
TMMFPrioritySettingsPckg pckg(prioritySet);
|
sl@0
|
330 |
|
sl@0
|
331 |
TPckgBuf<TInt> numberOfElementsPckg;
|
sl@0
|
332 |
User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyGetSupportedInputDataTypes, pckg, KNullDesC8, numberOfElementsPckg));
|
sl@0
|
333 |
|
sl@0
|
334 |
HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
|
sl@0
|
335 |
TPtr8 ptr = buf->Des();
|
sl@0
|
336 |
|
sl@0
|
337 |
|
sl@0
|
338 |
User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyCopyFourCCArrayData,KNullDesC8,KNullDesC8,ptr));
|
sl@0
|
339 |
RDesReadStream stream(ptr);
|
sl@0
|
340 |
CleanupClosePushL(stream);
|
sl@0
|
341 |
|
sl@0
|
342 |
for (TInt i=0; i<numberOfElementsPckg(); i++)
|
sl@0
|
343 |
{
|
sl@0
|
344 |
TInt err = aSupportedDataTypes.Append(stream.ReadInt32L());
|
sl@0
|
345 |
if (err)
|
sl@0
|
346 |
{//note we don't destroy array because we don't own it
|
sl@0
|
347 |
//but we do reset it as it is incomplete
|
sl@0
|
348 |
aSupportedDataTypes.Reset();
|
sl@0
|
349 |
User::Leave(err);
|
sl@0
|
350 |
}
|
sl@0
|
351 |
}
|
sl@0
|
352 |
CleanupStack::PopAndDestroy(2, buf);//stream, buf
|
sl@0
|
353 |
}
|
sl@0
|
354 |
|
sl@0
|
355 |
|
sl@0
|
356 |
EXPORT_C void RMMFDevSoundProxy::GetSupportedOutputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings)
|
sl@0
|
357 |
{
|
sl@0
|
358 |
aSupportedDataTypes.Reset();
|
sl@0
|
359 |
|
sl@0
|
360 |
TMMFPrioritySettings prioritySet = aPrioritySettings;
|
sl@0
|
361 |
TMMFPrioritySettingsPckg pckg(prioritySet);
|
sl@0
|
362 |
|
sl@0
|
363 |
TPckgBuf<TInt> numberOfElementsPckg;
|
sl@0
|
364 |
User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyGetSupportedOutputDataTypes, pckg, KNullDesC8, numberOfElementsPckg));
|
sl@0
|
365 |
|
sl@0
|
366 |
HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
|
sl@0
|
367 |
TPtr8 ptr = buf->Des();
|
sl@0
|
368 |
|
sl@0
|
369 |
|
sl@0
|
370 |
User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyCopyFourCCArrayData,KNullDesC8,KNullDesC8,ptr));
|
sl@0
|
371 |
RDesReadStream stream(ptr);
|
sl@0
|
372 |
CleanupClosePushL(stream);
|
sl@0
|
373 |
|
sl@0
|
374 |
for (TInt i=0; i<numberOfElementsPckg(); i++)
|
sl@0
|
375 |
{
|
sl@0
|
376 |
TInt err = aSupportedDataTypes.Append(stream.ReadInt32L());
|
sl@0
|
377 |
if (err)
|
sl@0
|
378 |
{//note we don't destroy array because we don't own it
|
sl@0
|
379 |
//but we do reset it as it is incomplete
|
sl@0
|
380 |
aSupportedDataTypes.Reset();
|
sl@0
|
381 |
User::Leave(err);
|
sl@0
|
382 |
}
|
sl@0
|
383 |
}
|
sl@0
|
384 |
CleanupStack::PopAndDestroy(2, buf);//stream, buf
|
sl@0
|
385 |
}
|
sl@0
|
386 |
|
sl@0
|
387 |
EXPORT_C TInt RMMFDevSoundProxy::SamplesRecorded()
|
sl@0
|
388 |
{
|
sl@0
|
389 |
TPckgBuf<TInt> numSamples;
|
sl@0
|
390 |
SendReceiveResult(EMMFDevSoundProxySamplesRecorded, KNullDesC8, KNullDesC8, numSamples);
|
sl@0
|
391 |
return numSamples();
|
sl@0
|
392 |
}
|
sl@0
|
393 |
|
sl@0
|
394 |
EXPORT_C TInt RMMFDevSoundProxy::SamplesPlayed()
|
sl@0
|
395 |
{
|
sl@0
|
396 |
TPckgBuf<TInt> numSamples;
|
sl@0
|
397 |
SendReceiveResult(EMMFDevSoundProxySamplesPlayed, KNullDesC8, KNullDesC8, numSamples);
|
sl@0
|
398 |
return numSamples();
|
sl@0
|
399 |
}
|
sl@0
|
400 |
|
sl@0
|
401 |
EXPORT_C void RMMFDevSoundProxy::SetToneRepeats(TInt aRepeatCount, const TTimeIntervalMicroSeconds& aRepeatTrailingSilence)
|
sl@0
|
402 |
{
|
sl@0
|
403 |
TPckgBuf<TInt> countRepeat(aRepeatCount);
|
sl@0
|
404 |
TPckgBuf<TTimeIntervalMicroSeconds> repeatTS(aRepeatTrailingSilence);
|
sl@0
|
405 |
SendReceive(EMMFDevSoundProxySetToneRepeats, countRepeat, repeatTS);
|
sl@0
|
406 |
}
|
sl@0
|
407 |
|
sl@0
|
408 |
EXPORT_C void RMMFDevSoundProxy::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings)
|
sl@0
|
409 |
{
|
sl@0
|
410 |
TPckgBuf<TMMFPrioritySettings> prioritySet(aPrioritySettings);
|
sl@0
|
411 |
SendReceive(EMMFDevSoundProxySetPrioritySettings, prioritySet);
|
sl@0
|
412 |
}
|
sl@0
|
413 |
|
sl@0
|
414 |
EXPORT_C const TDesC& RMMFDevSoundProxy::FixedSequenceName(TInt aSequenceNumber)
|
sl@0
|
415 |
{
|
sl@0
|
416 |
TPckgBuf<TInt> seqNum(aSequenceNumber);
|
sl@0
|
417 |
TPtr SeqNamePtr = iSeqName->Des();
|
sl@0
|
418 |
SeqNamePtr.FillZ();
|
sl@0
|
419 |
SendReceiveResult(EMMFDevSoundProxyFixedSequenceName, seqNum, KNullDesC8, SeqNamePtr);
|
sl@0
|
420 |
return *iSeqName;
|
sl@0
|
421 |
}
|
sl@0
|
422 |
|
sl@0
|
423 |
EXPORT_C TAny* RMMFDevSoundProxy::CustomInterface(TUid /*aInterfaceId*/)
|
sl@0
|
424 |
{
|
sl@0
|
425 |
// No custom interfaces are supported at the moment so return NULL.
|
sl@0
|
426 |
//TO DO
|
sl@0
|
427 |
return NULL;
|
sl@0
|
428 |
}
|
sl@0
|
429 |
|
sl@0
|
430 |
EXPORT_C TInt RMMFDevSoundProxy::FixedSequenceCount()
|
sl@0
|
431 |
{
|
sl@0
|
432 |
TPckgBuf<TInt> fixSeqCountPckg;
|
sl@0
|
433 |
SendReceiveResult(EMMFDevSoundProxyFixedSequenceCount, fixSeqCountPckg);
|
sl@0
|
434 |
return fixSeqCountPckg();
|
sl@0
|
435 |
}
|
sl@0
|
436 |
|
sl@0
|
437 |
EXPORT_C TInt RMMFDevSoundProxy::BufferToBeFilledData(TMMFDevSoundProxyHwBufPckg& aSetPckg)
|
sl@0
|
438 |
{
|
sl@0
|
439 |
// Note that there will only ever be one of these requests outstanding per session
|
sl@0
|
440 |
return SendReceiveResult(EMMFDevSoundProxyBTBFData, aSetPckg);
|
sl@0
|
441 |
}
|
sl@0
|
442 |
|
sl@0
|
443 |
EXPORT_C TInt RMMFDevSoundProxy::BufferToBeEmptiedData(TMMFDevSoundProxyHwBufPckg& aSetPckg)
|
sl@0
|
444 |
{
|
sl@0
|
445 |
// Note that there will only ever be one of these requests outstanding per session
|
sl@0
|
446 |
return SendReceiveResult(EMMFDevSoundProxyBTBEData, aSetPckg);
|
sl@0
|
447 |
}
|
sl@0
|
448 |
|
sl@0
|
449 |
EXPORT_C void RMMFDevSoundProxy::SetBuffer(CMMFDataBuffer* aBuffer)
|
sl@0
|
450 |
{
|
sl@0
|
451 |
if(iBuffer)
|
sl@0
|
452 |
{
|
sl@0
|
453 |
delete iBuffer;
|
sl@0
|
454 |
}
|
sl@0
|
455 |
iBuffer = aBuffer;
|
sl@0
|
456 |
}
|
sl@0
|
457 |
|
sl@0
|
458 |
EXPORT_C TInt RMMFDevSoundProxy::GetRecordedBufferL(CMMFDataBuffer& aBuffer)
|
sl@0
|
459 |
{
|
sl@0
|
460 |
return SendReceiveResult(EMMFDevSoundProxyGetRecordedBuffer, aBuffer.Data());
|
sl@0
|
461 |
}
|
sl@0
|
462 |
|
sl@0
|
463 |
EXPORT_C TInt RMMFDevSoundProxy::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData)
|
sl@0
|
464 |
{
|
sl@0
|
465 |
TMMFDevSoundProxySettings set;
|
sl@0
|
466 |
set.iNotificationEventUid = aEventType;
|
sl@0
|
467 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
468 |
return SendReceive(EMMFDevSoundProxyRequestResourceNotification, pckg, aNotificationRegistrationData);
|
sl@0
|
469 |
}
|
sl@0
|
470 |
|
sl@0
|
471 |
EXPORT_C TInt RMMFDevSoundProxy::CancelRegisterAsClient(TUid aEventType)
|
sl@0
|
472 |
{
|
sl@0
|
473 |
TMMFDevSoundProxySettings set;
|
sl@0
|
474 |
set.iNotificationEventUid = aEventType;
|
sl@0
|
475 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
476 |
return SendReceiveResult(EMMFDevSoundProxyCancelRequestResourceNotification, pckg);
|
sl@0
|
477 |
}
|
sl@0
|
478 |
|
sl@0
|
479 |
EXPORT_C TInt RMMFDevSoundProxy::GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData)
|
sl@0
|
480 |
{
|
sl@0
|
481 |
TMMFDevSoundProxySettings set;
|
sl@0
|
482 |
set.iNotificationEventUid = aEventType;
|
sl@0
|
483 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
484 |
return SendReceiveResult(EMMFDevSoundProxyGetResourceNotificationData, pckg,KNullDesC8,aNotificationData);
|
sl@0
|
485 |
}
|
sl@0
|
486 |
|
sl@0
|
487 |
EXPORT_C TInt RMMFDevSoundProxy::WillResumePlay()
|
sl@0
|
488 |
{
|
sl@0
|
489 |
return SendReceive(EMMFDevSoundProxyWillResumePlay);
|
sl@0
|
490 |
}
|
sl@0
|
491 |
|
sl@0
|
492 |
EXPORT_C TInt RMMFDevSoundProxy::EmptyBuffers()
|
sl@0
|
493 |
{
|
sl@0
|
494 |
return SendReceive(EMMFDevSoundProxyEmptyBuffers);
|
sl@0
|
495 |
}
|
sl@0
|
496 |
|
sl@0
|
497 |
EXPORT_C TInt RMMFDevSoundProxy::GetTimePlayed(TTimeIntervalMicroSeconds& aTime)
|
sl@0
|
498 |
{
|
sl@0
|
499 |
TTimeIntervalMicroSeconds time(0);
|
sl@0
|
500 |
TPckgBuf<TTimeIntervalMicroSeconds> timePckg(time);
|
sl@0
|
501 |
TInt err = SendReceiveResult(EMMFDevSoundProxyGetTimePlayed, KNullDesC8, KNullDesC8, timePckg);
|
sl@0
|
502 |
if(err==KErrNone)
|
sl@0
|
503 |
{
|
sl@0
|
504 |
aTime = timePckg();
|
sl@0
|
505 |
}
|
sl@0
|
506 |
return err;
|
sl@0
|
507 |
}
|
sl@0
|
508 |
|
sl@0
|
509 |
// implementation of a simple CustomCommand() scheme
|
sl@0
|
510 |
EXPORT_C TInt RMMFDevSoundProxy::SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
|
sl@0
|
511 |
{
|
sl@0
|
512 |
// the UID of the custom command is passed as an integer so as maintain consistency with the async methods below
|
sl@0
|
513 |
TInt command = aUid.iUid;
|
sl@0
|
514 |
|
sl@0
|
515 |
if (aOutParam==NULL)
|
sl@0
|
516 |
{
|
sl@0
|
517 |
return SendReceive(EMMFDevSoundProxySyncCustomCommand, command, aParam1, aParam2);
|
sl@0
|
518 |
}
|
sl@0
|
519 |
else
|
sl@0
|
520 |
{
|
sl@0
|
521 |
return SendReceiveResult(EMMFDevSoundProxySyncCustomCommandResult, command, aParam1, aParam2, *aOutParam);
|
sl@0
|
522 |
}
|
sl@0
|
523 |
}
|
sl@0
|
524 |
|
sl@0
|
525 |
EXPORT_C void RMMFDevSoundProxy::AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
|
sl@0
|
526 |
{
|
sl@0
|
527 |
// this seemingly only allows 1 simultaneous async call. Need an array of TRequestStatus for more than one call.
|
sl@0
|
528 |
// the UID of the custom command is passed as an integer so as to prevent the need of a consistent UID array.
|
sl@0
|
529 |
TInt command = aUid.iUid;
|
sl@0
|
530 |
|
sl@0
|
531 |
if (aOutParam==NULL)
|
sl@0
|
532 |
{
|
sl@0
|
533 |
SendReceive(EMMFDevSoundProxyAsyncCustomCommand, command, aParam1, aParam2, aStatus);
|
sl@0
|
534 |
}
|
sl@0
|
535 |
else
|
sl@0
|
536 |
{
|
sl@0
|
537 |
SendReceiveResult(EMMFDevSoundProxyAsyncCustomCommandResult, command, aParam1, aParam2, *aOutParam, aStatus);
|
sl@0
|
538 |
}
|
sl@0
|
539 |
}
|
sl@0
|
540 |
|
sl@0
|
541 |
EXPORT_C TInt RMMFDevSoundProxy::SetClientThreadInfo(TThreadId& aTid)
|
sl@0
|
542 |
{
|
sl@0
|
543 |
TPckgBuf<TThreadId> threadId(aTid);
|
sl@0
|
544 |
return SendReceive(EMMFDevSoundProxySetClientThreadInfo, threadId);
|
sl@0
|
545 |
}
|