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 <mmf/server/mmfswcodecwrapper.h> //for SwCodecWrapper CustomInterfaces
|
sl@0
|
17 |
#include <mmf/server/mmfswcodecwrappercustominterfacesuids.hrh>
|
sl@0
|
18 |
#ifdef SYMBIAN_MULTIMEDIA_CODEC_API
|
sl@0
|
19 |
#include <mmf/server/mmfhwdevicesetup.h>
|
sl@0
|
20 |
#endif // SYMBIAN_MULTIMEDIA_CODEC_API
|
sl@0
|
21 |
#include "MmfDevSoundServer.h"
|
sl@0
|
22 |
#include "MmfDevSoundSessionBody.h"
|
sl@0
|
23 |
/*
|
sl@0
|
24 |
*
|
sl@0
|
25 |
* Initializes DevSound object for the mode aMode for processing audio data
|
sl@0
|
26 |
* with hardware device aHWDev.
|
sl@0
|
27 |
*
|
sl@0
|
28 |
* On completion of Initialization, the observer will be notified via call back
|
sl@0
|
29 |
* InitializeComplete().
|
sl@0
|
30 |
*
|
sl@0
|
31 |
* Leaves on failure.
|
sl@0
|
32 |
*
|
sl@0
|
33 |
* @param "MDevSoundObserver& aDevSoundObserver"
|
sl@0
|
34 |
* A reference to DevSound Observer instance.
|
sl@0
|
35 |
*
|
sl@0
|
36 |
* @param "TUid aHWDev"
|
sl@0
|
37 |
* CMMFHwDevice implementation identifier.
|
sl@0
|
38 |
*
|
sl@0
|
39 |
* @param "TMMFState aMode"
|
sl@0
|
40 |
* Mode for which this object will be used.
|
sl@0
|
41 |
*
|
sl@0
|
42 |
*/
|
sl@0
|
43 |
|
sl@0
|
44 |
#ifdef _DEBUG
|
sl@0
|
45 |
_LIT(KMMFDevSoundSessionCategory, "MMFDevSoundSessionCategory");
|
sl@0
|
46 |
inline void Panic(TInt aError)
|
sl@0
|
47 |
{
|
sl@0
|
48 |
User::Panic(KMMFDevSoundSessionCategory, aError);
|
sl@0
|
49 |
}
|
sl@0
|
50 |
enum TMMFDevSoundSessionPanics
|
sl@0
|
51 |
{
|
sl@0
|
52 |
TMMFDevSoundSessionPolicyNotInvalidated
|
sl@0
|
53 |
};
|
sl@0
|
54 |
#endif
|
sl@0
|
55 |
|
sl@0
|
56 |
inline void CMMFDevSoundSvrImp::InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode)
|
sl@0
|
57 |
{
|
sl@0
|
58 |
TInt initError = KErrNone;
|
sl@0
|
59 |
iDevSoundObserver = &aDevSoundObserver;
|
sl@0
|
60 |
|
sl@0
|
61 |
if (aMode == EMMFStateIdle)
|
sl@0
|
62 |
User::Leave(KErrNotSupported);
|
sl@0
|
63 |
|
sl@0
|
64 |
iMode= static_cast<TMMFDevSoundState> (aMode);
|
sl@0
|
65 |
iHasPolicy = EFalse;
|
sl@0
|
66 |
|
sl@0
|
67 |
if (iMode == EMMFDevSoundStateRecording)
|
sl@0
|
68 |
{//DEF037912 incase the recording capabilities differ from play
|
sl@0
|
69 |
User::LeaveIfError(InitializeFormat(iRecordFormatsSupported, iRecordFormat));
|
sl@0
|
70 |
}
|
sl@0
|
71 |
|
sl@0
|
72 |
|
sl@0
|
73 |
iDevSoundObserver = &aDevSoundObserver;
|
sl@0
|
74 |
iHwDeviceID.iUid = aHWDev.iUid;
|
sl@0
|
75 |
if(iCMMFHwDevice)
|
sl@0
|
76 |
{
|
sl@0
|
77 |
delete iCMMFHwDevice;
|
sl@0
|
78 |
iHwDeviceBuffer = NULL; // buffer is deleted by HwDevice delete
|
sl@0
|
79 |
iPlayCustomInterface = NULL; //custom interfaces are also invalid
|
sl@0
|
80 |
iRecordCustomInterface = NULL;
|
sl@0
|
81 |
iTimePlayedCustomInterface = NULL;
|
sl@0
|
82 |
}
|
sl@0
|
83 |
|
sl@0
|
84 |
iCMMFHwDevice = NULL;
|
sl@0
|
85 |
|
sl@0
|
86 |
// Load the HwDevice implementation from ECom
|
sl@0
|
87 |
TRAP(initError,iCMMFHwDevice = CMMFHwDevice::NewL(aHWDev));//trap it to get debug print
|
sl@0
|
88 |
|
sl@0
|
89 |
if (initError == KErrNone)
|
sl@0
|
90 |
{
|
sl@0
|
91 |
#ifdef SYMBIAN_MULTIMEDIA_CODEC_API
|
sl@0
|
92 |
if (iFourCCSet)
|
sl@0
|
93 |
{
|
sl@0
|
94 |
MMdfHwDeviceSetup* setup = reinterpret_cast<MMdfHwDeviceSetup*>(iCMMFHwDevice->CustomInterface(KUidHwDeviceSetupInterface));
|
sl@0
|
95 |
if (setup!=NULL)
|
sl@0
|
96 |
{
|
sl@0
|
97 |
setup->SetDataTypesL(iSrcFourCC, iDestFourCC);
|
sl@0
|
98 |
}
|
sl@0
|
99 |
}
|
sl@0
|
100 |
#endif // SYMBIAN_MULTIMEDIA_CODEC_API
|
sl@0
|
101 |
iDevInfo.iHwDeviceObserver = this;
|
sl@0
|
102 |
initError = iCMMFHwDevice->Init(iDevInfo);
|
sl@0
|
103 |
if (initError == KErrNone)
|
sl@0
|
104 |
{
|
sl@0
|
105 |
TUid playCustomInterfaceUid;
|
sl@0
|
106 |
playCustomInterfaceUid.iUid = KMmfPlaySettingsCustomInterface;
|
sl@0
|
107 |
TUid recordCustomInterfaceUid;
|
sl@0
|
108 |
recordCustomInterfaceUid.iUid = KMmfRecordSettingsCustomInterface;
|
sl@0
|
109 |
iPlayCustomInterface =
|
sl@0
|
110 |
(MPlayCustomInterface*)iCMMFHwDevice->CustomInterface(playCustomInterfaceUid);
|
sl@0
|
111 |
if (!iPlayCustomInterface)
|
sl@0
|
112 |
{//DEF40443 need to check custom interface has been created
|
sl@0
|
113 |
initError = KErrNoMemory;//it won't if there is no memory
|
sl@0
|
114 |
}
|
sl@0
|
115 |
else
|
sl@0
|
116 |
{
|
sl@0
|
117 |
iRecordCustomInterface =
|
sl@0
|
118 |
(MRecordCustomInterface*)iCMMFHwDevice->CustomInterface(recordCustomInterfaceUid);
|
sl@0
|
119 |
if (!iRecordCustomInterface)
|
sl@0
|
120 |
initError = KErrNoMemory;
|
sl@0
|
121 |
}
|
sl@0
|
122 |
}
|
sl@0
|
123 |
}
|
sl@0
|
124 |
|
sl@0
|
125 |
// in the InitializeComplete() call we will signal the observer that the
|
sl@0
|
126 |
// custom interface may have changed
|
sl@0
|
127 |
iDevSoundObserver->InitializeComplete(initError);
|
sl@0
|
128 |
|
sl@0
|
129 |
if (initError)
|
sl@0
|
130 |
{
|
sl@0
|
131 |
User::Leave(initError);
|
sl@0
|
132 |
}
|
sl@0
|
133 |
__ASSERT_DEBUG(!(iHasPolicy&&(iMode == EMMFDevSoundStatePlaying)), Panic(TMMFDevSoundSessionPolicyNotInvalidated));
|
sl@0
|
134 |
}
|
sl@0
|
135 |
|
sl@0
|
136 |
/*
|
sl@0
|
137 |
*
|
sl@0
|
138 |
* Initializes DevSound object for the mode aMode for processing audio data
|
sl@0
|
139 |
* with hardware device supporting FourCC aDesiredFourCC.
|
sl@0
|
140 |
*
|
sl@0
|
141 |
* On completion of Initialization, the observer will be notified via call back
|
sl@0
|
142 |
* InitializeComplete().
|
sl@0
|
143 |
*
|
sl@0
|
144 |
* Leaves on failure.
|
sl@0
|
145 |
*
|
sl@0
|
146 |
* @param "MDevSoundObserver& aDevSoundObserver"
|
sl@0
|
147 |
* A reference to DevSound Observer instance.
|
sl@0
|
148 |
*
|
sl@0
|
149 |
* @param "TFourCC aDesiredFourCC"
|
sl@0
|
150 |
* CMMFHwDevice implementation FourCC.
|
sl@0
|
151 |
*
|
sl@0
|
152 |
* @param "TMMFState aMode"
|
sl@0
|
153 |
* Mode for which this object will be used.
|
sl@0
|
154 |
*
|
sl@0
|
155 |
*/
|
sl@0
|
156 |
inline void CMMFDevSoundSvrImp::InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode)
|
sl@0
|
157 |
{
|
sl@0
|
158 |
// to get HW Uid from the FourCC
|
sl@0
|
159 |
RImplInfoPtrArray plugInArray;
|
sl@0
|
160 |
TFourCC KPCM16FourCC(' ','P','1','6');
|
sl@0
|
161 |
_LIT(KNullString, "");
|
sl@0
|
162 |
|
sl@0
|
163 |
TUid hwDevicePluginInterface = {KMmfUidPluginInterfaceHwDevice};
|
sl@0
|
164 |
TUid implUid = {0};
|
sl@0
|
165 |
|
sl@0
|
166 |
CleanupResetAndDestroyPushL( plugInArray );
|
sl@0
|
167 |
// Get the implementation UID based on the FourCC and mode.
|
sl@0
|
168 |
#ifdef SYMBIAN_MULTIMEDIA_CODEC_API
|
sl@0
|
169 |
TInt err = KErrNone;
|
sl@0
|
170 |
RArray<TFourCC> dataTypes;
|
sl@0
|
171 |
CleanupClosePushL(dataTypes);
|
sl@0
|
172 |
|
sl@0
|
173 |
TRAP(err, iDevSoundUtil->SeekCodecPluginsL(dataTypes, aMode, EFalse));
|
sl@0
|
174 |
// if we find a new codec plugin
|
sl@0
|
175 |
TBool found = EFalse;
|
sl@0
|
176 |
if (!err && dataTypes.Find(aDesiredFourCC)!=KErrNotFound)
|
sl@0
|
177 |
{
|
sl@0
|
178 |
TRAP(err, iDevSoundUtil->FindHwDeviceAdapterL(hwDevicePluginInterface, plugInArray));
|
sl@0
|
179 |
if (err == KErrNone)
|
sl@0
|
180 |
{
|
sl@0
|
181 |
if (aMode == EMMFDevSoundStatePlaying)
|
sl@0
|
182 |
{//destination four CC is pcm16
|
sl@0
|
183 |
iFourCCSet = ETrue;
|
sl@0
|
184 |
iSrcFourCC = aDesiredFourCC;
|
sl@0
|
185 |
iDestFourCC = KPCM16FourCC;
|
sl@0
|
186 |
}
|
sl@0
|
187 |
else if (aMode == EMMFDevSoundStateRecording)
|
sl@0
|
188 |
{//source fourCC is pcm16
|
sl@0
|
189 |
iFourCCSet = ETrue;
|
sl@0
|
190 |
iSrcFourCC = KPCM16FourCC;
|
sl@0
|
191 |
iDestFourCC = aDesiredFourCC;
|
sl@0
|
192 |
}
|
sl@0
|
193 |
found = ETrue;
|
sl@0
|
194 |
}
|
sl@0
|
195 |
}
|
sl@0
|
196 |
if (!found)
|
sl@0
|
197 |
#endif // SYMBIAN_MULTIMEDIA_CODEC_API
|
sl@0
|
198 |
{
|
sl@0
|
199 |
plugInArray.ResetAndDestroy();
|
sl@0
|
200 |
if (aMode == EMMFDevSoundStatePlaying)
|
sl@0
|
201 |
{//destination four CC is pcm16
|
sl@0
|
202 |
iFourCCSet = ETrue;
|
sl@0
|
203 |
iSrcFourCC = aDesiredFourCC;
|
sl@0
|
204 |
iDestFourCC = KPCM16FourCC;
|
sl@0
|
205 |
iDevSoundUtil->SeekUsingFourCCL(hwDevicePluginInterface, plugInArray, aDesiredFourCC, KPCM16FourCC, KNullString);
|
sl@0
|
206 |
}
|
sl@0
|
207 |
else if (aMode == EMMFDevSoundStateRecording)
|
sl@0
|
208 |
{//source fourCC is pcm16
|
sl@0
|
209 |
iFourCCSet = ETrue;
|
sl@0
|
210 |
iSrcFourCC = KPCM16FourCC;
|
sl@0
|
211 |
iDestFourCC = aDesiredFourCC;
|
sl@0
|
212 |
iDevSoundUtil->SeekUsingFourCCL(hwDevicePluginInterface, plugInArray, KPCM16FourCC, aDesiredFourCC, KNullString);
|
sl@0
|
213 |
}
|
sl@0
|
214 |
else
|
sl@0
|
215 |
{
|
sl@0
|
216 |
User::Leave(KErrNotSupported);//invalid aMode cant set 4CC for tone
|
sl@0
|
217 |
}
|
sl@0
|
218 |
}
|
sl@0
|
219 |
|
sl@0
|
220 |
|
sl@0
|
221 |
if(plugInArray.Count() == 0)
|
sl@0
|
222 |
{ // couldn't find Decoder only implementation, try to get Decoder/Encoder
|
sl@0
|
223 |
iDevSoundUtil->SeekUsingFourCCL(hwDevicePluginInterface, plugInArray, aDesiredFourCC, aDesiredFourCC, KNullString);
|
sl@0
|
224 |
if(plugInArray.Count() == 0)
|
sl@0
|
225 |
User::Leave(KErrNotSupported);
|
sl@0
|
226 |
}
|
sl@0
|
227 |
implUid = plugInArray[0]->ImplementationUid(); // Just pick the first in the list
|
sl@0
|
228 |
|
sl@0
|
229 |
#ifdef SYMBIAN_MULTIMEDIA_CODEC_API
|
sl@0
|
230 |
CleanupStack::PopAndDestroy(2, &plugInArray) ; //pluginArray, dataTypes
|
sl@0
|
231 |
#else
|
sl@0
|
232 |
CleanupStack::PopAndDestroy() ; //pluginArray
|
sl@0
|
233 |
#endif // SYMBIAN_MULTIMEDIA_CODEC_API
|
sl@0
|
234 |
// If we made it here, there we have found implementation UID
|
sl@0
|
235 |
InitializeL(aDevSoundObserver, implUid, aMode);
|
sl@0
|
236 |
__ASSERT_DEBUG(!(iHasPolicy&&(iMode == EMMFDevSoundStatePlaying)), Panic(TMMFDevSoundSessionPolicyNotInvalidated));
|
sl@0
|
237 |
}
|
sl@0
|
238 |
|
sl@0
|
239 |
/*
|
sl@0
|
240 |
*
|
sl@0
|
241 |
* Returns the supported Audio settings.
|
sl@0
|
242 |
*
|
sl@0
|
243 |
* @return "TMMFCapabilities"
|
sl@0
|
244 |
* Device settings.
|
sl@0
|
245 |
*
|
sl@0
|
246 |
*/
|
sl@0
|
247 |
inline TMMFCapabilities CMMFDevSoundSvrImp::Capabilities()
|
sl@0
|
248 |
{
|
sl@0
|
249 |
return iDeviceCapabilities;
|
sl@0
|
250 |
}
|
sl@0
|
251 |
|
sl@0
|
252 |
/*
|
sl@0
|
253 |
*
|
sl@0
|
254 |
* Returns the current audio settings.
|
sl@0
|
255 |
*
|
sl@0
|
256 |
* @return "TMMFCapabilities"
|
sl@0
|
257 |
* Device settings.
|
sl@0
|
258 |
*
|
sl@0
|
259 |
*/
|
sl@0
|
260 |
inline TMMFCapabilities CMMFDevSoundSvrImp::Config() const
|
sl@0
|
261 |
{
|
sl@0
|
262 |
return iDeviceConfig;
|
sl@0
|
263 |
}
|
sl@0
|
264 |
|
sl@0
|
265 |
/*
|
sl@0
|
266 |
*
|
sl@0
|
267 |
* Returns an integer representing the maximum volume.
|
sl@0
|
268 |
*
|
sl@0
|
269 |
* This is the maximum value which can be passed to CMMFDevSoundProxy::SetVolume.
|
sl@0
|
270 |
*
|
sl@0
|
271 |
* @return "TInt"
|
sl@0
|
272 |
* The maximum volume. This value is platform dependent but is always
|
sl@0
|
273 |
* greater than or equal to one.
|
sl@0
|
274 |
*
|
sl@0
|
275 |
*/
|
sl@0
|
276 |
inline TInt CMMFDevSoundSvrImp::MaxVolume()
|
sl@0
|
277 |
{
|
sl@0
|
278 |
return iPlayFormatsSupported().iMaxVolume;
|
sl@0
|
279 |
}
|
sl@0
|
280 |
|
sl@0
|
281 |
/*
|
sl@0
|
282 |
*
|
sl@0
|
283 |
* Returns an integer representing the current volume.
|
sl@0
|
284 |
*
|
sl@0
|
285 |
* @return "TInt"
|
sl@0
|
286 |
* The current volume level.
|
sl@0
|
287 |
*
|
sl@0
|
288 |
*/
|
sl@0
|
289 |
inline TInt CMMFDevSoundSvrImp::Volume()
|
sl@0
|
290 |
{
|
sl@0
|
291 |
return iVolume;
|
sl@0
|
292 |
}
|
sl@0
|
293 |
|
sl@0
|
294 |
/*
|
sl@0
|
295 |
*
|
sl@0
|
296 |
* Returns an integer representing the maximum gain.
|
sl@0
|
297 |
*
|
sl@0
|
298 |
* This is the maximum value which can be passed to CMMFDevSoundProxy::SetGain.
|
sl@0
|
299 |
*
|
sl@0
|
300 |
* @return "TInt"
|
sl@0
|
301 |
* The maximum gain. This value is platform dependent but is always
|
sl@0
|
302 |
* greater than or equal to one.
|
sl@0
|
303 |
*
|
sl@0
|
304 |
*/
|
sl@0
|
305 |
inline TInt CMMFDevSoundSvrImp::MaxGain()
|
sl@0
|
306 |
{
|
sl@0
|
307 |
return iRecordFormatsSupported().iMaxVolume;//uses iMaxVolume for iMaxGain
|
sl@0
|
308 |
}
|
sl@0
|
309 |
|
sl@0
|
310 |
/*
|
sl@0
|
311 |
*
|
sl@0
|
312 |
* Returns an integer representing the current gain.
|
sl@0
|
313 |
*
|
sl@0
|
314 |
* @return "TInt"
|
sl@0
|
315 |
* The current gain level.
|
sl@0
|
316 |
*
|
sl@0
|
317 |
*/
|
sl@0
|
318 |
inline TInt CMMFDevSoundSvrImp::Gain()
|
sl@0
|
319 |
{
|
sl@0
|
320 |
return iGain;
|
sl@0
|
321 |
}
|
sl@0
|
322 |
|
sl@0
|
323 |
/*
|
sl@0
|
324 |
*
|
sl@0
|
325 |
* Returns the speaker balance set for playing.
|
sl@0
|
326 |
*
|
sl@0
|
327 |
* Leaves on failure.
|
sl@0
|
328 |
*
|
sl@0
|
329 |
* @param "TInt& aLeftPrecentage"
|
sl@0
|
330 |
* On return contains the left speaker volume percentage.
|
sl@0
|
331 |
*
|
sl@0
|
332 |
* @param "TInt& aRightPercentage"
|
sl@0
|
333 |
* On return contains the right speaker volume percentage.
|
sl@0
|
334 |
*
|
sl@0
|
335 |
*/
|
sl@0
|
336 |
inline void CMMFDevSoundSvrImp::GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage)
|
sl@0
|
337 |
{
|
sl@0
|
338 |
aLeftPercentage = iLeftPlayBalance;
|
sl@0
|
339 |
aRightPercentage = iRightPlayBalance;
|
sl@0
|
340 |
}
|
sl@0
|
341 |
|
sl@0
|
342 |
/*
|
sl@0
|
343 |
*
|
sl@0
|
344 |
* Returns the microphone gain balance set for recording.
|
sl@0
|
345 |
*
|
sl@0
|
346 |
* Leaves on failure.
|
sl@0
|
347 |
*
|
sl@0
|
348 |
* @param "TInt& aLeftPercentage"
|
sl@0
|
349 |
* On return contains the left microphone gain percentage.
|
sl@0
|
350 |
*
|
sl@0
|
351 |
* @param "TInt& aRightPercentage"
|
sl@0
|
352 |
* On return contains the right microphone gain percentage.
|
sl@0
|
353 |
*
|
sl@0
|
354 |
*/
|
sl@0
|
355 |
inline void CMMFDevSoundSvrImp::GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage)
|
sl@0
|
356 |
{
|
sl@0
|
357 |
aLeftPercentage = iLeftRecordBalance;
|
sl@0
|
358 |
aRightPercentage = iRightRecordBalance;
|
sl@0
|
359 |
}
|
sl@0
|
360 |
|
sl@0
|
361 |
/*
|
sl@0
|
362 |
*
|
sl@0
|
363 |
* Contine the process of recording. Once the buffer is filled with recorded
|
sl@0
|
364 |
* data, the Observer gets reference to buffer along with callback
|
sl@0
|
365 |
* BufferToBeEmptied(). After processing the buffer (copying over to a
|
sl@0
|
366 |
* different buffer or writing to file) the client should call this
|
sl@0
|
367 |
* method to continue recording process.
|
sl@0
|
368 |
*
|
sl@0
|
369 |
*/
|
sl@0
|
370 |
inline TBool CMMFDevSoundSvrImp::RecordData(const RMmfIpcMessage& aMessage)
|
sl@0
|
371 |
{
|
sl@0
|
372 |
ASSERT(iDevSoundObserver);
|
sl@0
|
373 |
if(iAudioPolicyPrioritySettings.iState != EMMFStateRecordData)
|
sl@0
|
374 |
{
|
sl@0
|
375 |
PanicClient(aMessage, EMMFDevSoundRecordDataWithoutInitialize);
|
sl@0
|
376 |
return EFalse;
|
sl@0
|
377 |
}
|
sl@0
|
378 |
// Checkes if the client has a UserEnvironment capability
|
sl@0
|
379 |
if (!aMessage.HasCapability(ECapabilityUserEnvironment))
|
sl@0
|
380 |
{
|
sl@0
|
381 |
iDevSoundObserver->RecordError(KErrPermissionDenied);
|
sl@0
|
382 |
return ETrue;
|
sl@0
|
383 |
}
|
sl@0
|
384 |
if(iCMMFHwDevice)
|
sl@0
|
385 |
{
|
sl@0
|
386 |
if ((iMode == EMMFDevSoundStateRecording) && iHasPolicy)
|
sl@0
|
387 |
{
|
sl@0
|
388 |
iHwDeviceBuffer->Data().SetLength(iHwDeviceBuffer->RequestSize());
|
sl@0
|
389 |
TInt error = iCMMFHwDevice->ThisHwBufferEmptied(*iHwDeviceBuffer);
|
sl@0
|
390 |
if(error != KErrNone)
|
sl@0
|
391 |
{
|
sl@0
|
392 |
Error(error);
|
sl@0
|
393 |
iCMMFHwDevice->Stop();
|
sl@0
|
394 |
}
|
sl@0
|
395 |
|
sl@0
|
396 |
}
|
sl@0
|
397 |
}
|
sl@0
|
398 |
return ETrue;
|
sl@0
|
399 |
}
|
sl@0
|
400 |
|
sl@0
|
401 |
/*
|
sl@0
|
402 |
*
|
sl@0
|
403 |
* Defines the number of times the audio is to be repeated during the tone
|
sl@0
|
404 |
* playback operation.
|
sl@0
|
405 |
*
|
sl@0
|
406 |
* A period of silence can follow each playing of tone. The tone playing can
|
sl@0
|
407 |
* be repeated indefinitely.
|
sl@0
|
408 |
*
|
sl@0
|
409 |
* @param "TInt aRepeatCount"
|
sl@0
|
410 |
* The number of times the tone, together with the trailing silence,
|
sl@0
|
411 |
* is to be repeated. If this is set to KMdaRepeatForever, then the
|
sl@0
|
412 |
* tone, together with the trailing silence, is repeated indefinitely
|
sl@0
|
413 |
* or until Stop() is called. If this is set to zero, then the tone is
|
sl@0
|
414 |
* not repeated.
|
sl@0
|
415 |
*
|
sl@0
|
416 |
* Supported only during tone playing.
|
sl@0
|
417 |
*
|
sl@0
|
418 |
*/
|
sl@0
|
419 |
inline void CMMFDevSoundSvrImp::SetToneRepeats(TInt aRepeatCount,
|
sl@0
|
420 |
const TTimeIntervalMicroSeconds& aRepeatTrailingSilence)
|
sl@0
|
421 |
{
|
sl@0
|
422 |
iRepeatCount = aRepeatCount;
|
sl@0
|
423 |
iRepeatTrailingSilence = aRepeatTrailingSilence;
|
sl@0
|
424 |
}
|
sl@0
|
425 |
|
sl@0
|
426 |
/*
|
sl@0
|
427 |
*
|
sl@0
|
428 |
* Defines the priority settings that should be used for this instance.
|
sl@0
|
429 |
*
|
sl@0
|
430 |
* @param "const TMMFPrioritySettings& aPrioritySettings"
|
sl@0
|
431 |
* An class type representing the client's priority, priority
|
sl@0
|
432 |
* preference and state.
|
sl@0
|
433 |
*
|
sl@0
|
434 |
*/
|
sl@0
|
435 |
inline void CMMFDevSoundSvrImp::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings)
|
sl@0
|
436 |
{
|
sl@0
|
437 |
iAudioPolicyPrioritySettings.iPref = aPrioritySettings.iPref;
|
sl@0
|
438 |
iAudioPolicyPrioritySettings.iPriority = aPrioritySettings.iPriority;
|
sl@0
|
439 |
}
|
sl@0
|
440 |
|
sl@0
|
441 |
// Currently only support bitrate custom interface
|
sl@0
|
442 |
inline TAny* CMMFDevSoundSvrImp::CustomInterface(TUid aInterfaceId)
|
sl@0
|
443 |
{
|
sl@0
|
444 |
TAny* ptr = NULL;
|
sl@0
|
445 |
if (iCMMFHwDevice)
|
sl@0
|
446 |
{
|
sl@0
|
447 |
ptr = iCMMFHwDevice->CustomInterface(aInterfaceId);
|
sl@0
|
448 |
}
|
sl@0
|
449 |
|
sl@0
|
450 |
return ptr;
|
sl@0
|
451 |
}
|
sl@0
|
452 |
|
sl@0
|
453 |
/*
|
sl@0
|
454 |
*
|
sl@0
|
455 |
* Returns the number of available pre-defined tone sequences.
|
sl@0
|
456 |
*
|
sl@0
|
457 |
* This is the number of fixed sequence supported by DevSound by default.
|
sl@0
|
458 |
*
|
sl@0
|
459 |
* @return "TInt"
|
sl@0
|
460 |
* The fixed sequence count. This value is implementation dependent
|
sl@0
|
461 |
* but is always greater than or equal to zero.
|
sl@0
|
462 |
*
|
sl@0
|
463 |
*/
|
sl@0
|
464 |
inline TInt CMMFDevSoundSvrImp::FixedSequenceCount()
|
sl@0
|
465 |
{
|
sl@0
|
466 |
return iFixedSequences->Count();
|
sl@0
|
467 |
}
|
sl@0
|
468 |
|
sl@0
|
469 |
/*
|
sl@0
|
470 |
*
|
sl@0
|
471 |
* Returns the name assigned to a specific pre-defined tone sequence.
|
sl@0
|
472 |
*
|
sl@0
|
473 |
* This is the number of fixed sequence supported by DevSound by default.
|
sl@0
|
474 |
*
|
sl@0
|
475 |
* The function raises a panic if sequence number specified invalid.
|
sl@0
|
476 |
*
|
sl@0
|
477 |
* @return "TDesC&"
|
sl@0
|
478 |
* A reference to a Descriptor containing the fixed sequence
|
sl@0
|
479 |
* name indexed by aSequenceNumber.
|
sl@0
|
480 |
*
|
sl@0
|
481 |
* @param "TInt aSequenceNumber"
|
sl@0
|
482 |
* The index identifying the specific pre-defined tone sequence. Index
|
sl@0
|
483 |
* values are relative to zero.
|
sl@0
|
484 |
* This can be any value from zero to the value returned by a call to
|
sl@0
|
485 |
* FixedSequenceCount() - 1.
|
sl@0
|
486 |
* The function raises a panic if sequence number is not within this
|
sl@0
|
487 |
* range.
|
sl@0
|
488 |
*
|
sl@0
|
489 |
* @see FixedSequenceCount()
|
sl@0
|
490 |
*
|
sl@0
|
491 |
*/
|
sl@0
|
492 |
inline const TDesC& CMMFDevSoundSvrImp::FixedSequenceName(TInt aSequenceNumber)
|
sl@0
|
493 |
{
|
sl@0
|
494 |
ASSERT((aSequenceNumber >= 0)&&(aSequenceNumber < iFixedSequences->Count()));
|
sl@0
|
495 |
return iDevSoundUtil->FixedSequenceName(aSequenceNumber);
|
sl@0
|
496 |
}
|
sl@0
|
497 |
|
sl@0
|
498 |
/*
|
sl@0
|
499 |
*
|
sl@0
|
500 |
* Sets Id for this instance of DevSound
|
sl@0
|
501 |
*
|
sl@0
|
502 |
* @param "TInt aDevSoundId"
|
sl@0
|
503 |
* Integer value assigned by Audio Policy Server
|
sl@0
|
504 |
*
|
sl@0
|
505 |
*/
|
sl@0
|
506 |
inline void CMMFDevSoundSvrImp::SetDevSoundId(TInt aDevSoundId)
|
sl@0
|
507 |
{
|
sl@0
|
508 |
iDevSoundInfo.iDevSoundId = aDevSoundId;
|
sl@0
|
509 |
}
|
sl@0
|
510 |
|
sl@0
|
511 |
/*
|
sl@0
|
512 |
*
|
sl@0
|
513 |
* Returns information about this DevSound instance.
|
sl@0
|
514 |
*
|
sl@0
|
515 |
* This method is used by Audio Policy Server to make audio policy decisions.
|
sl@0
|
516 |
*
|
sl@0
|
517 |
* @return "TMMFDevSoundinfo"
|
sl@0
|
518 |
* A reference to TMMFDevSoundinfo object holding the current settings
|
sl@0
|
519 |
* of this DevSound instance.
|
sl@0
|
520 |
*
|
sl@0
|
521 |
*/
|
sl@0
|
522 |
inline TMMFDevSoundInfo CMMFDevSoundSvrImp::DevSoundInfo()
|
sl@0
|
523 |
{
|
sl@0
|
524 |
return iDevSoundInfo;
|
sl@0
|
525 |
}
|
sl@0
|
526 |
|
sl@0
|
527 |
|
sl@0
|
528 |
/*
|
sl@0
|
529 |
* Updates the total bytes played.
|
sl@0
|
530 |
*
|
sl@0
|
531 |
*/
|
sl@0
|
532 |
inline void CMMFDevSoundSvrImp::UpdateBytesPlayed()
|
sl@0
|
533 |
{
|
sl@0
|
534 |
if (iPlayCustomInterface)
|
sl@0
|
535 |
iPlayedBytesCount = iPlayCustomInterface->BytesPlayed();
|
sl@0
|
536 |
}
|