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