os/mm/mmhais/refacladapt/src/audiocodec/audiocodec.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
//audiocodec.cpp
sl@0
     2
sl@0
     3
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     4
// All rights reserved.
sl@0
     5
// This component and the accompanying materials are made available
sl@0
     6
// under the terms of "Eclipse Public License v1.0"
sl@0
     7
// which accompanies this distribution, and is available
sl@0
     8
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     9
//
sl@0
    10
// Initial Contributors:
sl@0
    11
// Nokia Corporation - initial contribution.
sl@0
    12
//
sl@0
    13
// Contributors:
sl@0
    14
//
sl@0
    15
// Description:
sl@0
    16
//
sl@0
    17
sl@0
    18
sl@0
    19
sl@0
    20
#include <a3f/a3fbase.h>
sl@0
    21
#include <a3f/a3ffourcclookup.h>
sl@0
    22
#include <a3f/audioprocessingunittypeuids.h>
sl@0
    23
#include "maudiocodecadaptationobserver.h"
sl@0
    24
#include "audiocodec.h"
sl@0
    25
#include "resourcedata.h"
sl@0
    26
sl@0
    27
// THIS WILL REMAIN UNTIL THE REQUIREMENT WILL BE DEFINED
sl@0
    28
// THIS IMPLEMENTATION WILL WORK ONLY FOR HW DEVICES IMPLEMNETED AS SOFTWARE CODEC WRAPPERS
sl@0
    29
#define INCLUDE_HWDEVICES_AS_SWCODEC_WRAPPERS
sl@0
    30
sl@0
    31
#ifdef INCLUDE_HWDEVICES_AS_SWCODEC_WRAPPERS
sl@0
    32
#include <mmf/server/mmfswcodecwrappercustominterfacesuids.hrh>
sl@0
    33
#endif
sl@0
    34
sl@0
    35
const TInt KMicroSecsInOneSec = 1000000;
sl@0
    36
const TInt KHwDeviceDefaultDataLength= 9;
sl@0
    37
const TUint KDefaultMaxGain = 255; // TODO should discover at run time but this is value of current Symbian sound driver adaptor
sl@0
    38
sl@0
    39
//Values to find the request ask by the client
sl@0
    40
const TInt KRequestSampleRate = 0x0001;
sl@0
    41
const TInt KRequestMode = 0x0002;
sl@0
    42
const TAudioModeTableEntry KModeTableLookup[] = {
sl@0
    43
							{ EMMFMono, {KA3FModeMonoValue} },
sl@0
    44
							{ EMMFStereo, {KA3FModeStereoNonInterleavedValue} },
sl@0
    45
							};
sl@0
    46
sl@0
    47
sl@0
    48
// ---------------------------------------------------------------------------
sl@0
    49
// Constructor
sl@0
    50
// ---------------------------------------------------------------------------
sl@0
    51
CAudioCodec::CAudioCodec(TUid aTypeId, const CFourCCConvertor& aFourCCConvertor)
sl@0
    52
	: CActive(EPriorityStandard),
sl@0
    53
	iLastBuffer(EFalse),
sl@0
    54
	iHwDeviceState(EIdle),
sl@0
    55
	iLastBufferAck(EFalse), 
sl@0
    56
	iRampOperation(KNullUid)
sl@0
    57
	{
sl@0
    58
	TRACE_CREATE();
sl@0
    59
	DP_CONTEXT(CAudioCodec::CAudioCodec *CD1*, CtxDevSound, DPLOCAL);
sl@0
    60
	DP_IN();
sl@0
    61
	if(aTypeId==KUidAudioEncoder)
sl@0
    62
		{
sl@0
    63
		iMode = EEncode;
sl@0
    64
		}
sl@0
    65
	else if(aTypeId==KUidAudioDecoder)
sl@0
    66
		{
sl@0
    67
		iMode = EDecode;
sl@0
    68
		}
sl@0
    69
	iFourCCConvertor = static_cast<CFourCCConvertor*>( const_cast<CFourCCConvertor*>(&aFourCCConvertor) );
sl@0
    70
sl@0
    71
	iHwDeviceInitArgs.iEapStreamId = 0;
sl@0
    72
	iHwDeviceInitArgs.iPolicyId = 0;
sl@0
    73
	DP_OUT();
sl@0
    74
	}
sl@0
    75
sl@0
    76
// ---------------------------------------------------------------------------
sl@0
    77
// Factory method
sl@0
    78
// ---------------------------------------------------------------------------
sl@0
    79
EXPORT_C CAudioCodec* CAudioCodec::NewL(TUid aTypeId, const CFourCCConvertor& aFourCCConvertor)
sl@0
    80
	{
sl@0
    81
	DP_STATIC_CONTEXT(CAudioCodec::NewL *CD0*, CtxDevSound, DPLOCAL);
sl@0
    82
	DP_IN();
sl@0
    83
	CAudioCodec* self = new(ELeave)CAudioCodec(aTypeId, aFourCCConvertor);
sl@0
    84
	CleanupStack::PushL(self);
sl@0
    85
	self->ConstructL();
sl@0
    86
	CleanupStack::Pop(self);
sl@0
    87
	DP0_RET(self, "0x%x");
sl@0
    88
	}
sl@0
    89
sl@0
    90
// ---------------------------------------------------------------------------
sl@0
    91
// Second phase constructor
sl@0
    92
// ---------------------------------------------------------------------------
sl@0
    93
void CAudioCodec::ConstructL()
sl@0
    94
	{
sl@0
    95
	DP_CONTEXT(CAudioCodec::ConstructL *CD1*, CtxDevSound, DPLOCAL);
sl@0
    96
	DP_IN();
sl@0
    97
	CActiveScheduler::Add(this);
sl@0
    98
	DP_OUT();
sl@0
    99
	}
sl@0
   100
sl@0
   101
// ---------------------------------------------------------------------------
sl@0
   102
// Destructor
sl@0
   103
// ---------------------------------------------------------------------------
sl@0
   104
CAudioCodec::~CAudioCodec()
sl@0
   105
	{
sl@0
   106
	DP_CONTEXT(CAudioCodec::~CAudioCodec *CD1*, CtxDevSound, DPLOCAL);
sl@0
   107
	DP_IN();
sl@0
   108
	iAudioCodecObservers.Close();
sl@0
   109
	if (iHwDevice)
sl@0
   110
		{
sl@0
   111
		if (!iHwDeviceState == EStopped)
sl@0
   112
			{
sl@0
   113
			DP0(DLINFO, "StopAndDeleteCodec");
sl@0
   114
			iHwDevice->StopAndDeleteCodec();
sl@0
   115
			}
sl@0
   116
		delete iHwDevice;
sl@0
   117
		iHwDevice = NULL;
sl@0
   118
		}
sl@0
   119
	Cancel();
sl@0
   120
	DP_OUT();
sl@0
   121
	}
sl@0
   122
sl@0
   123
// ---------------------------------------------------------------------------
sl@0
   124
// CAudioCodec::SetFormat
sl@0
   125
// ---------------------------------------------------------------------------
sl@0
   126
EXPORT_C TInt CAudioCodec::SetFormat(TUid aFormat)
sl@0
   127
	{
sl@0
   128
	DP_CONTEXT(CAudioCodec::SetFormat *CD1*, CtxDevSound, DPLOCAL);
sl@0
   129
	DP_IN();
sl@0
   130
	iFormat = aFormat;
sl@0
   131
	DP0_RET(KErrNone, "%d");
sl@0
   132
	}
sl@0
   133
sl@0
   134
// ---------------------------------------------------------------------------
sl@0
   135
// CAudioCodec::Initialize
sl@0
   136
// ---------------------------------------------------------------------------
sl@0
   137
EXPORT_C TInt CAudioCodec::Initialize()
sl@0
   138
	{
sl@0
   139
	DP_CONTEXT(CAudioCodec::Initialize *CD1*, CtxDevSound, DPLOCAL);
sl@0
   140
	DP_IN();
sl@0
   141
	TInt err(KErrNone);
sl@0
   142
	TFourCC aFourCC(0);
sl@0
   143
	err = iFourCCConvertor->FormatToFourCC(iFormat,aFourCC);
sl@0
   144
	if(err == KErrNotFound)
sl@0
   145
		{
sl@0
   146
		err = KErrNotSupported;
sl@0
   147
		}
sl@0
   148
	if(err == KErrNone)
sl@0
   149
		{
sl@0
   150
		TRAP(err,  FourCCToHwDeviceUidL(aFourCC, iMode, iDeviceUid) );
sl@0
   151
		}
sl@0
   152
	if (err == KErrNone)
sl@0
   153
		{
sl@0
   154
		err = LoadHwDevice();
sl@0
   155
		}
sl@0
   156
		
sl@0
   157
#ifdef INCLUDE_HWDEVICES_AS_SWCODEC_WRAPPERS
sl@0
   158
	if (err == KErrNone)
sl@0
   159
		{
sl@0
   160
		TUid interfaceUid = {0};
sl@0
   161
		TAny* interface = NULL;
sl@0
   162
		if (iMode == EDecode)
sl@0
   163
			{
sl@0
   164
			interfaceUid.iUid = KMmfPlaySettingsCustomInterface;
sl@0
   165
			}
sl@0
   166
		else if(iMode == EEncode)
sl@0
   167
			{
sl@0
   168
			interfaceUid.iUid = KMmfRecordSettingsCustomInterface;
sl@0
   169
			}
sl@0
   170
		
sl@0
   171
		// This call at the sw codec wrapper creates the custom interfaces for playing and record
sl@0
   172
		if(iHwDevice)
sl@0
   173
			{
sl@0
   174
			interface = iHwDevice->CustomInterface(interfaceUid);
sl@0
   175
			if (iMode == EDecode)
sl@0
   176
				{
sl@0
   177
				iPlayCustomInterface = static_cast<MPlayCustomInterface*>(interface);
sl@0
   178
				}
sl@0
   179
			else if(iMode == EEncode)
sl@0
   180
				{
sl@0
   181
				iRecordCustomInterface = static_cast<MRecordCustomInterface*>(interface);
sl@0
   182
				}
sl@0
   183
			}
sl@0
   184
		}
sl@0
   185
sl@0
   186
#endif
sl@0
   187
	if(err == KErrNone)
sl@0
   188
		{
sl@0
   189
		err = InitHwDevice();
sl@0
   190
		}
sl@0
   191
	DP0_RET(err, "%d");
sl@0
   192
	}
sl@0
   193
	
sl@0
   194
// ---------------------------------------------------------------------------
sl@0
   195
// CAudioCodec::Load
sl@0
   196
// ---------------------------------------------------------------------------
sl@0
   197
EXPORT_C TInt CAudioCodec::Load(TInt aSampleRate, TUid aMode)
sl@0
   198
	{
sl@0
   199
	DP_CONTEXT(CAudioCodec::Load *CD1*, CtxDevSound, DPLOCAL);
sl@0
   200
	DP_IN();
sl@0
   201
	iSampleRateConfig = aSampleRate;
sl@0
   202
	iModeConfig = aMode;
sl@0
   203
	TInt err(KErrNone);
sl@0
   204
	err = SetHwDeviceConfig();
sl@0
   205
	DP0_RET(err, "%d");
sl@0
   206
	}
sl@0
   207
sl@0
   208
// ---------------------------------------------------------------------------
sl@0
   209
// CAudioCodec::Start
sl@0
   210
// ---------------------------------------------------------------------------
sl@0
   211
EXPORT_C TInt CAudioCodec::Start()
sl@0
   212
	{
sl@0
   213
	DP_CONTEXT(CAudioCodec::Start *CD1*, CtxDevSound, DPLOCAL);
sl@0
   214
	DP_IN();
sl@0
   215
	TInt err(KErrNone);
sl@0
   216
	iLastBuffer = EFalse;
sl@0
   217
	
sl@0
   218
	// Needed since ToneHwDevice only exchange one buffer with its client
sl@0
   219
	// Resume shouldn't clear the last buffer flag 
sl@0
   220
	// since this wont' result on a new buffer request
sl@0
   221
	if(iHwDeviceState == EPaused && iDeviceUid.iUid == KUidToneHwDevice)
sl@0
   222
		{
sl@0
   223
		iLastBuffer = ETrue;
sl@0
   224
		}
sl@0
   225
sl@0
   226
	if (iHwDevice)
sl@0
   227
		{
sl@0
   228
		PRF(PRF_ID, PRF_START, PRF_TIME, AA_DS_StartHwDevice, "");
sl@0
   229
		if (iMode == EDecode)
sl@0
   230
			{
sl@0
   231
			// PLAY
sl@0
   232
			err = iHwDevice->Start(EDevDecode, EDevOutFlow);
sl@0
   233
			DP1(DLINFO,"hwdevice decode start: error %d",err);
sl@0
   234
			iIgnoreUnderflowInterface = reinterpret_cast<MIgnoreUnderflowEventsCustomInterface*>(iHwDevice->CustomInterface(KIgnoreUnderflowCustomInterfaceTypeUid));	
sl@0
   235
			if(iIgnoreUnderflowInterface)
sl@0
   236
				{
sl@0
   237
				iIgnoreUnderflowInterface->IgnoreUnderflowEvents();
sl@0
   238
				}
sl@0
   239
			}
sl@0
   240
		else if (iMode == EEncode)
sl@0
   241
			{
sl@0
   242
			// RECORD
sl@0
   243
			err = iHwDevice->Start(EDevEncode, EDevInFlow);
sl@0
   244
			DP1(DLINFO,"hwdevice encode start: error %d",err);
sl@0
   245
			}
sl@0
   246
		else
sl@0
   247
			{
sl@0
   248
			err = KErrNotSupported;
sl@0
   249
			DP1(DLINFO,"CAudioCodec::StartHwDevice - Unknown mode %d", iMode);
sl@0
   250
			}
sl@0
   251
		PRF(PRF_ID, PRF_STOP, PRF_TIME, AA_DS_StartHwDevice, "");
sl@0
   252
		}
sl@0
   253
	else
sl@0
   254
		{
sl@0
   255
		err = KErrHardwareNotAvailable;
sl@0
   256
		}
sl@0
   257
sl@0
   258
	if (err == KErrNone)
sl@0
   259
		{
sl@0
   260
		iHwDeviceState = ERunning;
sl@0
   261
		}
sl@0
   262
	iLastBufferAck = EFalse;	
sl@0
   263
	DP0_RET(err, "%d");
sl@0
   264
	}
sl@0
   265
sl@0
   266
// ---------------------------------------------------------------------------
sl@0
   267
// CAudioCodec::Pause
sl@0
   268
// ---------------------------------------------------------------------------
sl@0
   269
EXPORT_C TInt CAudioCodec::Pause()
sl@0
   270
	{
sl@0
   271
	DP_CONTEXT(CAudioCodec::Pause *CD1*, CtxDevSound, DPLOCAL);
sl@0
   272
	DP_IN();
sl@0
   273
	TInt err(KErrNone);
sl@0
   274
	if (iHwDevice)
sl@0
   275
		{
sl@0
   276
		DP0(DLINFO,"Pause hwdevice");
sl@0
   277
		err = iHwDevice->Pause();
sl@0
   278
		}
sl@0
   279
	iHwDeviceState = EPaused;
sl@0
   280
	DP0_RET(err, "%d");
sl@0
   281
	}
sl@0
   282
sl@0
   283
// ---------------------------------------------------------------------------
sl@0
   284
// CAudioCodec::Stop
sl@0
   285
// ---------------------------------------------------------------------------
sl@0
   286
EXPORT_C TInt CAudioCodec::Stop()
sl@0
   287
	{
sl@0
   288
	DP_CONTEXT(CAudioCodec::Stop *CD1*, CtxDevSound, DPLOCAL);
sl@0
   289
	DP_IN();
sl@0
   290
	TInt err(KErrNone);
sl@0
   291
	if (iHwDevice && !(iHwDeviceState == EStopped)) 
sl@0
   292
		{
sl@0
   293
		DP0(DLINFO,"Stop hwdevice");
sl@0
   294
		UpdateBytesPlayed();
sl@0
   295
		err = iHwDevice->Stop();
sl@0
   296
		iHwDeviceState = EStopped;
sl@0
   297
		}
sl@0
   298
	iLastBufferAck = EFalse;
sl@0
   299
	DP0_RET(err, "%d");
sl@0
   300
	}
sl@0
   301
sl@0
   302
// ---------------------------------------------------------------------------
sl@0
   303
// CAudioCodec::GetSupportedSampleRates
sl@0
   304
// ---------------------------------------------------------------------------
sl@0
   305
TInt CAudioCodec::GetSupportedSampleRates(RArray<TInt>& aSupportedRates)
sl@0
   306
	{
sl@0
   307
	DP_CONTEXT(CAudioCodec::GetSupportedSampleRates *CD1*, CtxDevSound, DPLOCAL);
sl@0
   308
	DP_IN();
sl@0
   309
	TInt err(KErrNone);
sl@0
   310
	aSupportedRates.Reset();
sl@0
   311
	// Ask for rates from resource files
sl@0
   312
	err = ReadResourceRates(aSupportedRates);
sl@0
   313
sl@0
   314
	DP0_RET(err, "%d");
sl@0
   315
	}
sl@0
   316
sl@0
   317
// ---------------------------------------------------------------------------
sl@0
   318
// CAudioCodec::GetSupportedModes
sl@0
   319
// ---------------------------------------------------------------------------
sl@0
   320
TInt CAudioCodec::GetSupportedModes(RArray<TUid>& aSupportedModes)
sl@0
   321
	{
sl@0
   322
	DP_CONTEXT(CAudioCodec::GetSupportedModes *CD1*, CtxDevSound, DPLOCAL);
sl@0
   323
	DP_IN();
sl@0
   324
	TInt err(KErrNone);
sl@0
   325
	aSupportedModes.Reset();
sl@0
   326
	// Ask for modes from resource files
sl@0
   327
	err = ReadResourceModes(aSupportedModes);
sl@0
   328
sl@0
   329
	DP0_RET(err, "%d");
sl@0
   330
	}
sl@0
   331
sl@0
   332
// ---------------------------------------------------------------------------
sl@0
   333
// CAudioCodec::GetCustomInterface
sl@0
   334
// ---------------------------------------------------------------------------
sl@0
   335
TInt CAudioCodec::RequestCustomInterface(TUid aUid, TAny*& aPtr)
sl@0
   336
	{
sl@0
   337
	DP_CONTEXT(CAudioCodec::GetCustomInterface *CD1*, CtxDevSound, DPLOCAL);
sl@0
   338
	DP_IN();
sl@0
   339
	TInt err = KErrNone;
sl@0
   340
	if(iHwDevice)
sl@0
   341
		{
sl@0
   342
		aPtr = iHwDevice->CustomInterface(aUid);
sl@0
   343
		}
sl@0
   344
	else
sl@0
   345
		{
sl@0
   346
		err = KErrNotReady;
sl@0
   347
		}
sl@0
   348
	DP0_RET(err, "%d");
sl@0
   349
	}
sl@0
   350
sl@0
   351
// ---------------------------------------------------------------------------
sl@0
   352
// CAudioCodec::RegisterObserver
sl@0
   353
// ---------------------------------------------------------------------------
sl@0
   354
TInt CAudioCodec::RegisterObserver(MCustomInterfaceSupportObserver& aObserver)
sl@0
   355
	{
sl@0
   356
	DP_CONTEXT(CAudioCodec::RegisterObserver *CD1*, CtxDevSound, DPLOCAL);
sl@0
   357
	DP_IN();
sl@0
   358
	TInt err = KErrNone;
sl@0
   359
	err = iCISupportObservers.Find(&aObserver);
sl@0
   360
	if( err != KErrNotFound )
sl@0
   361
		{
sl@0
   362
		err = KErrAlreadyExists;
sl@0
   363
		}
sl@0
   364
	else
sl@0
   365
		{
sl@0
   366
		err = iCISupportObservers.Append(&aObserver);
sl@0
   367
		}
sl@0
   368
	DP0_RET(err, "%d");
sl@0
   369
	}
sl@0
   370
sl@0
   371
// ---------------------------------------------------------------------------
sl@0
   372
// CAudioCodec::UnRegisterObserver
sl@0
   373
// ---------------------------------------------------------------------------
sl@0
   374
void CAudioCodec::UnRegisterObserver(MCustomInterfaceSupportObserver& aObserver)
sl@0
   375
	{
sl@0
   376
	DP_CONTEXT(CAudioCodec::UnRegisterObserver *CD1*, CtxDevSound, DPLOCAL);
sl@0
   377
	DP_IN();
sl@0
   378
	TInt idxOrErr = iCISupportObservers.Find(&aObserver);
sl@0
   379
	if( idxOrErr != KErrNotFound )
sl@0
   380
		{
sl@0
   381
		iCISupportObservers.Remove(idxOrErr);
sl@0
   382
		}
sl@0
   383
	DP_OUT();
sl@0
   384
	}
sl@0
   385
sl@0
   386
// ---------------------------------------------------------------------------
sl@0
   387
// CAudioCodec::LoadHwDevice
sl@0
   388
// ---------------------------------------------------------------------------
sl@0
   389
TInt CAudioCodec::LoadHwDevice()
sl@0
   390
	{
sl@0
   391
	DP_CONTEXT(CAudioCodec::LoadHwDevice *CD1*, CtxDevSound, DPLOCAL);
sl@0
   392
	DP_IN();
sl@0
   393
	TInt err(KErrNone);
sl@0
   394
sl@0
   395
	if(iDeviceUid==KNullUid)
sl@0
   396
		{
sl@0
   397
		DP0_RET(KErrNotSupported, "%d");
sl@0
   398
		}
sl@0
   399
sl@0
   400
	TRAP(err, iHwDevice = CMMFHwDevice::NewL(iDeviceUid));
sl@0
   401
	if(err == KErrNotFound)
sl@0
   402
		{
sl@0
   403
		err = KErrNotSupported;
sl@0
   404
		}
sl@0
   405
	DP0_RET(err, "%d");
sl@0
   406
	}
sl@0
   407
sl@0
   408
// ---------------------------------------------------------------------------
sl@0
   409
// CAudioCodec::InitHwDevice
sl@0
   410
// ---------------------------------------------------------------------------
sl@0
   411
TInt CAudioCodec::InitHwDevice()
sl@0
   412
	{
sl@0
   413
	DP_CONTEXT(CAudioCodec::InitHwDevice *CD1*, CtxDevSound, DPLOCAL);
sl@0
   414
	DP_IN();
sl@0
   415
	TInt err(KErrNone);
sl@0
   416
	DP1(DLINFO, "eapStreamId %d", iHwDeviceInitArgs.iEapStreamId);
sl@0
   417
	DP1(DLINFO, "policyId %d", iHwDeviceInitArgs.iPolicyId);
sl@0
   418
sl@0
   419
	iHwDeviceInitParams.iHwDeviceObserver = this;
sl@0
   420
	iHwDeviceInitParams.iHwDeviceInitArgsPtr.Set((TUint8*)&(iHwDeviceInitArgs),
sl@0
   421
														sizeof(THwDeviceInitArgs),
sl@0
   422
														sizeof(THwDeviceInitArgs));
sl@0
   423
	if (iHwDevice)
sl@0
   424
		{
sl@0
   425
		err = iHwDevice->Init(iHwDeviceInitParams);
sl@0
   426
		}
sl@0
   427
	else
sl@0
   428
		{
sl@0
   429
		err = KErrHardwareNotAvailable;
sl@0
   430
		}
sl@0
   431
	DP0_RET(err, "%d");
sl@0
   432
	}
sl@0
   433
sl@0
   434
// ---------------------------------------------------------------------------
sl@0
   435
// CAudioCodec::SetHwDeviceConfig
sl@0
   436
// ---------------------------------------------------------------------------
sl@0
   437
TInt CAudioCodec::SetHwDeviceConfig()
sl@0
   438
	{
sl@0
   439
	DP_CONTEXT(CAudioCodec::SetHwDeviceConfig *CD1*, CtxDevSound, DPLOCAL);
sl@0
   440
	DP_IN();
sl@0
   441
	TInt err(KErrNone);
sl@0
   442
sl@0
   443
	//TODO Look for another way to set those parameters
sl@0
   444
	TTaskConfig taskconfig;
sl@0
   445
	taskconfig.iUid = KUidRefDevSoundTaskConfig;
sl@0
   446
	taskconfig.iStereoMode = ResolveMode(iModeConfig);
sl@0
   447
	taskconfig.iRate = iSampleRateConfig;
sl@0
   448
sl@0
   449
	DP1(DLINFO, "taskconfig.iRate %d", taskconfig.iRate);
sl@0
   450
	DP1(DLINFO, "taskconfig.iStereoMode %d", taskconfig.iStereoMode);
sl@0
   451
	DP1(DLINFO, "taskconfig.iUid %d", taskconfig.iUid);
sl@0
   452
sl@0
   453
	if (err == KErrNone && iHwDevice)
sl@0
   454
		{
sl@0
   455
		err = iHwDevice->SetConfig(taskconfig);
sl@0
   456
		}
sl@0
   457
	else
sl@0
   458
		{
sl@0
   459
		err = KErrHardwareNotAvailable;
sl@0
   460
		}
sl@0
   461
	DP0_RET(err, "%d");
sl@0
   462
	}
sl@0
   463
sl@0
   464
// ---------------------------------------------------------------------------
sl@0
   465
// CAudioCodec::ReadResourceRates
sl@0
   466
// ---------------------------------------------------------------------------
sl@0
   467
TInt CAudioCodec::ReadResourceRates(RArray<TInt>& aRates)
sl@0
   468
	{
sl@0
   469
	DP_CONTEXT(CAudioCodec::ReadResourceRates*CD1*, CtxDevSound, DPLOCAL);
sl@0
   470
	DP_IN();
sl@0
   471
	TInt err(KErrNone);
sl@0
   472
sl@0
   473
	CResourceData* resource = NULL;
sl@0
   474
	TRAP(err, resource = CResourceData::NewL(iDeviceUid));
sl@0
   475
	if (err == KErrNone && resource)
sl@0
   476
		{
sl@0
   477
		err = resource->GetSSampleRates(iMode,aRates);
sl@0
   478
		delete resource;
sl@0
   479
		}
sl@0
   480
sl@0
   481
	DP0_RET(err, "%d");
sl@0
   482
	}
sl@0
   483
sl@0
   484
// ---------------------------------------------------------------------------
sl@0
   485
// CAudioCodec::ReadResourceModes
sl@0
   486
// ---------------------------------------------------------------------------
sl@0
   487
TInt CAudioCodec::ReadResourceModes(RArray<TUid>& aModes)
sl@0
   488
	{
sl@0
   489
	DP_CONTEXT(CAudioCodec::ReadResourceModes*CD1*, CtxDevSound, DPLOCAL);
sl@0
   490
	DP_IN();
sl@0
   491
	TInt err(KErrNone);
sl@0
   492
sl@0
   493
	CResourceData* resource = NULL;
sl@0
   494
	TRAP(err, resource = CResourceData::NewL(iDeviceUid));
sl@0
   495
	if (err == KErrNone && resource)
sl@0
   496
		{
sl@0
   497
		err = resource->GetSModes(iMode,aModes);
sl@0
   498
		delete resource;
sl@0
   499
		}
sl@0
   500
sl@0
   501
	DP0_RET(err, "%d");
sl@0
   502
	}
sl@0
   503
sl@0
   504
// ---------------------------------------------------------------------------
sl@0
   505
// from class MAudioComponent
sl@0
   506
// CAudioCodec::GetOutputPort
sl@0
   507
// ---------------------------------------------------------------------------
sl@0
   508
TInt CAudioCodec::GetOutputPort(MOutputPort*& aOutputPort)
sl@0
   509
	{
sl@0
   510
	DP_CONTEXT(CAudioCodec::GetOutputPort *CD1*, CtxDevSound, DPLOCAL);
sl@0
   511
	DP_IN();
sl@0
   512
	aOutputPort = this;
sl@0
   513
	DP0_RET(KErrNone, "%d");
sl@0
   514
	}
sl@0
   515
sl@0
   516
// ---------------------------------------------------------------------------
sl@0
   517
// from class MAudioComponent
sl@0
   518
// CAudioCodec::GetInputPort
sl@0
   519
// ---------------------------------------------------------------------------
sl@0
   520
TInt CAudioCodec::GetInputPort(MInputPort*& aInputPort)
sl@0
   521
	{
sl@0
   522
	DP_CONTEXT(CAudioCodec::GetInputPort *CD1*, CtxDevSound, DPLOCAL);
sl@0
   523
	DP_IN();
sl@0
   524
	aInputPort = this;
sl@0
   525
	DP0_RET(KErrNone, "%d");
sl@0
   526
	}
sl@0
   527
sl@0
   528
// ---------------------------------------------------------------------------
sl@0
   529
// from class MAudioComponent
sl@0
   530
// CAudioCodec::RegisterAudioComponentObserver
sl@0
   531
// ---------------------------------------------------------------------------
sl@0
   532
EXPORT_C TInt CAudioCodec::RegisterAudioCodecObserver(MAudioCodecAdaptationObserver& aObserver)
sl@0
   533
	{
sl@0
   534
	DP_CONTEXT(CAudioCodec::RegisterAudioCodecObserver *CD1*, CtxDevSound, DPLOCAL);
sl@0
   535
	DP_IN();
sl@0
   536
	TInt err = iAudioCodecObservers.Find(&aObserver);
sl@0
   537
	if(err == KErrNotFound)
sl@0
   538
		{
sl@0
   539
		iAudioCodecObservers.Append(&aObserver);
sl@0
   540
		err = KErrNone;
sl@0
   541
		}
sl@0
   542
	else
sl@0
   543
		{
sl@0
   544
		err = KErrAlreadyExists;
sl@0
   545
		}
sl@0
   546
	DP0_RET(err,"%d");
sl@0
   547
	}
sl@0
   548
sl@0
   549
// ---------------------------------------------------------------------------
sl@0
   550
// from class MAudioComponent
sl@0
   551
// CAudioCodec::UnregisterAudioComponentObserver
sl@0
   552
// ---------------------------------------------------------------------------
sl@0
   553
EXPORT_C void CAudioCodec::UnregisterAudioCodecObserver(MAudioCodecAdaptationObserver& aObserver)
sl@0
   554
	{
sl@0
   555
	DP_CONTEXT(CAudioCodec::UnregisterAudioCodecObserver *CD1*, CtxDevSound, DPLOCAL);
sl@0
   556
	DP_IN();
sl@0
   557
	TInt idxOrErr = iAudioCodecObservers.Find(&aObserver);
sl@0
   558
	if( idxOrErr != KErrNotFound )
sl@0
   559
		{
sl@0
   560
		iAudioCodecObservers.Remove(idxOrErr);
sl@0
   561
		}
sl@0
   562
	DP_OUT();
sl@0
   563
	}
sl@0
   564
sl@0
   565
// ---------------------------------------------------------------------------
sl@0
   566
// from class MInputPort
sl@0
   567
// CAudioCodec::EmptyBuffer
sl@0
   568
// ---------------------------------------------------------------------------
sl@0
   569
TInt CAudioCodec::EmptyBuffer(CMMFBuffer* /*aBuffer*/, MOutputPort* /*aSupplier*/)
sl@0
   570
	{
sl@0
   571
	DP_CONTEXT(CAudioCodec::EmptyBuffer *CD1*, CtxDevSound, DPLOCAL);
sl@0
   572
	DP_IN();
sl@0
   573
	DP0_RET(KErrNotReady, "%d");
sl@0
   574
	}
sl@0
   575
sl@0
   576
// ---------------------------------------------------------------------------
sl@0
   577
// from class MInputPort
sl@0
   578
// CAudioCodec::BufferFilled
sl@0
   579
// ---------------------------------------------------------------------------
sl@0
   580
TInt CAudioCodec::BufferFilled(CMMFBuffer* aBuffer)
sl@0
   581
	{
sl@0
   582
	DP_CONTEXT(CAudioCodec::BufferFilled *CD1*, CtxDevSound, DPLOCAL);
sl@0
   583
	DP_IN();
sl@0
   584
	PRF(PRF_ID, PRF_STOP, PRF_LOAD, AA_DS_Fill, "");
sl@0
   585
	TInt err(KErrNone);
sl@0
   586
	if(aBuffer->LastBuffer())
sl@0
   587
		{
sl@0
   588
		iLastBuffer = ETrue;
sl@0
   589
		}
sl@0
   590
	if(iHwDevice)
sl@0
   591
		{
sl@0
   592
		err = iHwDevice->ThisHwBufferFilled(*aBuffer);
sl@0
   593
		}
sl@0
   594
	else
sl@0
   595
		{
sl@0
   596
		err = KErrNotFound;
sl@0
   597
		}
sl@0
   598
	DP0_RET(err,"%d");
sl@0
   599
	}
sl@0
   600
sl@0
   601
// ---------------------------------------------------------------------------
sl@0
   602
// from class MInputPort
sl@0
   603
// CAudioCodec::SetOutput
sl@0
   604
// ---------------------------------------------------------------------------
sl@0
   605
TInt CAudioCodec::SetOutput(MOutputPort* aOutput)
sl@0
   606
	{
sl@0
   607
	DP_CONTEXT(CAudioCodec::SetOutput *CD1*, CtxDevSound, DPLOCAL);
sl@0
   608
	DP_IN();
sl@0
   609
	TInt err = KErrNone;
sl@0
   610
	
sl@0
   611
	iOutputPort = aOutput;
sl@0
   612
	
sl@0
   613
	DP0_RET(err, "%d");
sl@0
   614
	}
sl@0
   615
sl@0
   616
// ---------------------------------------------------------------------------
sl@0
   617
// from class MInputPort
sl@0
   618
// CAudioCodec::RemoveOutput
sl@0
   619
// ---------------------------------------------------------------------------
sl@0
   620
TInt CAudioCodec::RemoveOutput(MOutputPort* /*aOutput*/)
sl@0
   621
	{
sl@0
   622
	DP_CONTEXT(CAudioCodec::RemoveOutput *CD1*, CtxDevSound, DPLOCAL);
sl@0
   623
	DP_IN();
sl@0
   624
	DP0_RET(KErrNone, "%d");
sl@0
   625
	}
sl@0
   626
sl@0
   627
// ---------------------------------------------------------------------------
sl@0
   628
// from class MOutputPort
sl@0
   629
// CAudioCodec::FillBuffer
sl@0
   630
// ---------------------------------------------------------------------------
sl@0
   631
TInt CAudioCodec::FillBuffer(CMMFBuffer* /*aBuffer*/, MInputPort* /*aConsumer*/)
sl@0
   632
	{
sl@0
   633
	DP_CONTEXT(CAudioCodec::FillBuffer *CD1*, CtxDevSound, DPLOCAL);
sl@0
   634
	DP_IN();
sl@0
   635
	DP0_RET(KErrNotReady, "%d");
sl@0
   636
	}
sl@0
   637
sl@0
   638
// ---------------------------------------------------------------------------
sl@0
   639
// from class MOutputPort
sl@0
   640
// CAudioCodec::BufferEmptied
sl@0
   641
// ---------------------------------------------------------------------------
sl@0
   642
TInt CAudioCodec::BufferEmptied(CMMFBuffer* aBuffer)
sl@0
   643
	{
sl@0
   644
	DP_CONTEXT(CAudioCodec::BufferEmptied *CD1*, CtxDevSound, DPLOCAL);
sl@0
   645
	DP_IN();
sl@0
   646
	TInt err(KErrNone);
sl@0
   647
	
sl@0
   648
	if (!aBuffer)
sl@0
   649
		{
sl@0
   650
		err = KErrNotFound;
sl@0
   651
		DP0_RET(err, "%d");
sl@0
   652
		}
sl@0
   653
sl@0
   654
	if (iLastBufferAck) //if the hwdevice return a buffer with the lastbuffer flag set, rather than returning a non-empty buffer
sl@0
   655
		{				//in this case we generate an empty buffer on behalf of the adaptation
sl@0
   656
		TInt count = iAudioCodecObservers.Count();
sl@0
   657
		for ( TInt i(0); i < count; i++ ) // causes a ProcessingFinished() to be called on the stream
sl@0
   658
			{
sl@0
   659
			iAudioCodecObservers[i]->AllBuffersProcessed();
sl@0
   660
			}
sl@0
   661
		iLastBufferAck = EFalse;
sl@0
   662
		}
sl@0
   663
	else 
sl@0
   664
		{
sl@0
   665
		if(aBuffer->LastBuffer())
sl@0
   666
			{
sl@0
   667
			iLastBuffer = ETrue;
sl@0
   668
			}
sl@0
   669
		if(iHwDevice)
sl@0
   670
			{ 
sl@0
   671
			err = iHwDevice->ThisHwBufferEmptied(*aBuffer);
sl@0
   672
			}
sl@0
   673
		else
sl@0
   674
			{
sl@0
   675
			err = KErrNotFound;
sl@0
   676
			}
sl@0
   677
		}
sl@0
   678
	DP0_RET(err,"%d");
sl@0
   679
	}
sl@0
   680
sl@0
   681
// ---------------------------------------------------------------------------
sl@0
   682
// from class MOutputPort
sl@0
   683
// CAudioCodec::SetInput
sl@0
   684
// ---------------------------------------------------------------------------
sl@0
   685
TInt CAudioCodec::SetInput(MInputPort* aInput)
sl@0
   686
	{
sl@0
   687
	DP_CONTEXT(CAudioCodec::SetInput *CD1*, CtxDevSound, DPLOCAL);
sl@0
   688
	DP_IN();
sl@0
   689
	TInt err = KErrNone;
sl@0
   690
	
sl@0
   691
	iInputPort = aInput;
sl@0
   692
	
sl@0
   693
	DP0_RET(err, "%d");
sl@0
   694
	}
sl@0
   695
sl@0
   696
// ---------------------------------------------------------------------------
sl@0
   697
// from class MOutputPort
sl@0
   698
// CAudioCodec::RemoveInput
sl@0
   699
// ---------------------------------------------------------------------------
sl@0
   700
TInt CAudioCodec::RemoveInput(MInputPort* /*aInput*/)
sl@0
   701
	{
sl@0
   702
	return KErrNone;
sl@0
   703
	}
sl@0
   704
sl@0
   705
// ---------------------------------------------------------------------------
sl@0
   706
// from class MOutputPort
sl@0
   707
// CAudioCodec::FlushBuffer
sl@0
   708
// ---------------------------------------------------------------------------
sl@0
   709
TInt CAudioCodec::FlushBuffer(MFlushHandlerObserver* aFlushObserver)
sl@0
   710
	{
sl@0
   711
	TInt err = KErrNone;
sl@0
   712
	TAny* ptr = NULL;
sl@0
   713
sl@0
   714
	// Flush low layer buffers
sl@0
   715
	if(iHwDevice)
sl@0
   716
		{
sl@0
   717
		ptr = iHwDevice->CustomInterface(TUid::Uid(KMmfUidEmptyBuffersCustomInterface));
sl@0
   718
		MMMFDevSoundEmptyBuffers* emptybuffers = static_cast<MMMFDevSoundEmptyBuffers*>(ptr);
sl@0
   719
		if (emptybuffers)
sl@0
   720
			{
sl@0
   721
			// Due to defect DEF127468, this do nothing
sl@0
   722
			err = emptybuffers->EmptyBuffers();
sl@0
   723
			}
sl@0
   724
		else
sl@0
   725
			{
sl@0
   726
			err = KErrNotSupported;
sl@0
   727
			}
sl@0
   728
		}
sl@0
   729
	else
sl@0
   730
		{
sl@0
   731
		err = KErrNotReady;
sl@0
   732
		}
sl@0
   733
sl@0
   734
	// Flush source through an asynchronous request
sl@0
   735
	if(err == KErrNone)
sl@0
   736
		{
sl@0
   737
		err = iOutputPort->FlushBuffer(aFlushObserver);
sl@0
   738
		}
sl@0
   739
	return err;
sl@0
   740
	}
sl@0
   741
sl@0
   742
sl@0
   743
// ---------------------------------------------------------------------------
sl@0
   744
// from class MMMFHwDeviceObserver
sl@0
   745
// CAudioCodec::FillThisHwBuffer
sl@0
   746
// ---------------------------------------------------------------------------
sl@0
   747
TInt CAudioCodec::FillThisHwBuffer(CMMFBuffer& aHwBuffer)
sl@0
   748
	{
sl@0
   749
	DP_CONTEXT(CAudioCodec::FillThisHwBuffer *CD1*, CtxDevSound, DPLOCAL);
sl@0
   750
	DP_IN();
sl@0
   751
	PRF(PRF_ID, PRF_START, PRF_LOAD, AA_DS_Fill, "");
sl@0
   752
sl@0
   753
	TInt err(KErrNone);
sl@0
   754
	iAdaptationBuffer = static_cast<CMMFDataBuffer*> (&aHwBuffer);
sl@0
   755
sl@0
   756
	ASSERT(iAdaptationBuffer);
sl@0
   757
	if (iLastBuffer)
sl@0
   758
		{
sl@0
   759
		iAdaptationBuffer->Data().SetLength(0);
sl@0
   760
		BufferFilled(iAdaptationBuffer);
sl@0
   761
		}
sl@0
   762
	else
sl@0
   763
		{
sl@0
   764
		TRAP(err,iAdaptationBuffer->SetRequestSizeL(iAdaptationBuffer->Data().MaxLength() ));
sl@0
   765
		if(err == KErrNone)
sl@0
   766
			{
sl@0
   767
			if(iOutputPort)
sl@0
   768
				{
sl@0
   769
				err = iOutputPort->FillBuffer(&aHwBuffer, this);
sl@0
   770
				}
sl@0
   771
			else
sl@0
   772
				{
sl@0
   773
				err = KErrNotFound;
sl@0
   774
				}
sl@0
   775
			}
sl@0
   776
		}
sl@0
   777
	DP0_RET(err,"%d");
sl@0
   778
	}
sl@0
   779
sl@0
   780
// ---------------------------------------------------------------------------
sl@0
   781
// from class MMMFHwDeviceObserver
sl@0
   782
// CAudioCodec::EmptyThisHwBuffer
sl@0
   783
// ---------------------------------------------------------------------------
sl@0
   784
TInt CAudioCodec::EmptyThisHwBuffer(CMMFBuffer& aHwBuffer)
sl@0
   785
	{
sl@0
   786
	DP_CONTEXT(CAudioCodec::EmptyThisHwBuffer *CD1*, CtxDevSound, DPLOCAL);
sl@0
   787
	DP_IN();
sl@0
   788
sl@0
   789
	TInt err(KErrNone);
sl@0
   790
	iAdaptationBuffer = static_cast<CMMFDataBuffer*> (&aHwBuffer);
sl@0
   791
	ASSERT(iAdaptationBuffer);
sl@0
   792
	if(iHwDeviceState == EPaused)
sl@0
   793
		{
sl@0
   794
		if (iAdaptationBuffer->Data().Length() == 0) // empty buffer
sl@0
   795
			{
sl@0
   796
			TInt count = iAudioCodecObservers.Count();
sl@0
   797
			for ( TInt i(0); i < count; i++ ) // causes a ProcessingFinished() to be called on the stream
sl@0
   798
				{
sl@0
   799
				iAudioCodecObservers[i]->AllBuffersProcessed();
sl@0
   800
				}
sl@0
   801
			}
sl@0
   802
		else
sl@0
   803
			{
sl@0
   804
			if(aHwBuffer.LastBuffer())
sl@0
   805
				{
sl@0
   806
				aHwBuffer.SetLastBuffer(EFalse);	// a buffer coming from hardware device should never have last buffer set...
sl@0
   807
				iLastBufferAck = ETrue;
sl@0
   808
				}
sl@0
   809
			
sl@0
   810
			TRAP(err,iAdaptationBuffer->SetRequestSizeL(iAdaptationBuffer->Data().Length()));
sl@0
   811
			if(err == KErrNone)
sl@0
   812
				{
sl@0
   813
				if(iInputPort)
sl@0
   814
					{
sl@0
   815
					err = iInputPort->EmptyBuffer(&aHwBuffer, this);
sl@0
   816
					}
sl@0
   817
				else
sl@0
   818
					{
sl@0
   819
					err = KErrNotFound;
sl@0
   820
					}
sl@0
   821
				}			
sl@0
   822
			}
sl@0
   823
		}
sl@0
   824
	else
sl@0
   825
		{
sl@0
   826
		TRAP(err,iAdaptationBuffer->SetRequestSizeL(iAdaptationBuffer->Data().Length()));
sl@0
   827
		if(err == KErrNone)
sl@0
   828
			{
sl@0
   829
			if(iInputPort)
sl@0
   830
				{
sl@0
   831
				err = iInputPort->EmptyBuffer(&aHwBuffer, this);
sl@0
   832
				}
sl@0
   833
			else
sl@0
   834
				{
sl@0
   835
				err = KErrNotFound;
sl@0
   836
				}
sl@0
   837
			}
sl@0
   838
		}
sl@0
   839
	DP0_RET(err,"%d");
sl@0
   840
	}
sl@0
   841
sl@0
   842
// ---------------------------------------------------------------------------
sl@0
   843
// from class MMMFHwDeviceObserver
sl@0
   844
// CAudioCodec::MsgFromHwDevice
sl@0
   845
// ---------------------------------------------------------------------------
sl@0
   846
TInt CAudioCodec::MsgFromHwDevice(TUid aMessageType, const TDesC8& aMsg)
sl@0
   847
	{
sl@0
   848
	DP_CONTEXT(CAudioCodec::MsgFromHwDevice *CD1*, CtxDevSound, DPLOCAL);
sl@0
   849
	DP_IN();
sl@0
   850
	TBuf<50> formattedNumber;
sl@0
   851
	formattedNumber.Format(_L("MessageType 0x%08x"), aMessageType.iUid);
sl@0
   852
	TBuf<50> buf;
sl@0
   853
	buf.Copy(aMsg);
sl@0
   854
	buf.Append(formattedNumber);
sl@0
   855
	if(aMessageType.iUid == KMmfHwDeviceObserverUpdateBytesPlayed)
sl@0
   856
		{
sl@0
   857
		//This is used by sw codec wrapper to request a bytes played update
sl@0
   858
		//Bytes played won't be updated in Stopped() or Error() on sw codec wrapper
sl@0
   859
		//As the sound device is closed. Non sw codec wrapper Hw device plugins
sl@0
   860
		//Can get the bytes updated on Stopped() and/or Error()
sl@0
   861
		UpdateBytesPlayed();
sl@0
   862
		}
sl@0
   863
	DP1(DLINFO, "DeviceMessage is %S",&buf);
sl@0
   864
	DP0_RET(KErrNone, "%d");
sl@0
   865
	}
sl@0
   866
sl@0
   867
// ---------------------------------------------------------------------------
sl@0
   868
// from class MMMFHwDeviceObserver
sl@0
   869
// CAudioCodec::Stopped
sl@0
   870
// ---------------------------------------------------------------------------
sl@0
   871
void CAudioCodec::Stopped()
sl@0
   872
	{
sl@0
   873
	DP_CONTEXT(CAudioCodec::Stopped *CD1*, CtxDevSound, DPLOCAL);
sl@0
   874
	DP_IN();
sl@0
   875
	//For sw codec wrappers hw devices bytes played are updated in MsgFromHwDevice
sl@0
   876
	//But non sw codec wrappers hw devices may do it differently
sl@0
   877
	//Also don't know if non sw codec wrappers hw devices will call Stopped or Error first
sl@0
   878
	UpdateBytesPlayed();
sl@0
   879
	DP_OUT();
sl@0
   880
	}
sl@0
   881
sl@0
   882
// ---------------------------------------------------------------------------
sl@0
   883
// from class MMMFHwDeviceObserver
sl@0
   884
// CAudioCodec::Error
sl@0
   885
// ---------------------------------------------------------------------------
sl@0
   886
//
sl@0
   887
void CAudioCodec::Error(TInt aError)
sl@0
   888
	{
sl@0
   889
	DP_CONTEXT(CAudioCodec::Error *CD1*, CtxDevSound, DPLOCAL);
sl@0
   890
	DP_IN();
sl@0
   891
sl@0
   892
	TTimeIntervalMicroSeconds currentPosition;
sl@0
   893
	TInt err = KErrNone;
sl@0
   894
sl@0
   895
#ifdef _DEBUG
sl@0
   896
	RDebug::Print(_L("iDeviceUid=0x%x  aError=%d iLastBuffer=%d"), iDeviceUid.iUid, aError, iLastBuffer);
sl@0
   897
#endif 
sl@0
   898
	// The most problable receiver is the logicalaudiocodec which should notify to the client through MAudioProcessingUnit
sl@0
   899
	TUint count = iAudioCodecObservers.Count();
sl@0
   900
	
sl@0
   901
	// Notify only for the
sl@0
   902
	if (aError == KErrUnderflow && iMode == EDecode ) 
sl@0
   903
		{
sl@0
   904
		// Notify the observers
sl@0
   905
		if(iLastBuffer)
sl@0
   906
			{
sl@0
   907
			for ( TUint i(0); i < count; i++ )
sl@0
   908
				{
sl@0
   909
				iAudioCodecObservers[i]->AllBuffersProcessed();
sl@0
   910
				}
sl@0
   911
			}
sl@0
   912
		else
sl@0
   913
			{		
sl@0
   914
			// Re-start decoding
sl@0
   915
sl@0
   916
			//For sw codec wrappers hw devices bytes played are updated in MsgFromHwDevice
sl@0
   917
			//But non sw codec wrappers hw devices may do it differently
sl@0
   918
			//Also don't know if non sw codec wrappers hw devices will call Stopped or Error first
sl@0
   919
			UpdateBytesPlayed();
sl@0
   920
sl@0
   921
			err = GetControlPosition(currentPosition);
sl@0
   922
			if(err != KErrNone)
sl@0
   923
				{
sl@0
   924
				// Ignore safely
sl@0
   925
				}
sl@0
   926
			
sl@0
   927
#ifdef _DEBUG
sl@0
   928
	RDebug::Print(_L("Restart decoding"));
sl@0
   929
#endif 			
sl@0
   930
					
sl@0
   931
			Start();
sl@0
   932
			}
sl@0
   933
		}
sl@0
   934
	else if (aError == KErrOverflow && iMode == EEncode )
sl@0
   935
		{
sl@0
   936
		if (!iLastBuffer  && iHwDeviceState == ERunning)
sl@0
   937
			{
sl@0
   938
			// Re-start encoding
sl@0
   939
			err = GetControlPosition(currentPosition);
sl@0
   940
			if(err != KErrNone)
sl@0
   941
				{
sl@0
   942
				// Ignore safely
sl@0
   943
				}
sl@0
   944
			Start();
sl@0
   945
			}
sl@0
   946
		else
sl@0
   947
			{
sl@0
   948
				if (iDeviceUid.iUid != KUidToneHwDevice) 
sl@0
   949
					{
sl@0
   950
#ifdef _DEBUG
sl@0
   951
	RDebug::Print(_L("Is this is not needed for other encoders but toneHwDevice"));
sl@0
   952
#endif 
sl@0
   953
					for ( TUint i(0); i < count; i++ )
sl@0
   954
						{
sl@0
   955
						iAudioCodecObservers[i]->AllBuffersProcessed();
sl@0
   956
						}
sl@0
   957
					}
sl@0
   958
			}
sl@0
   959
		}
sl@0
   960
	else
sl@0
   961
		{
sl@0
   962
		for ( TUint i(0); i < count; i++ )
sl@0
   963
			{
sl@0
   964
			iAudioCodecObservers[i]->ProcessingUnitError(aError);
sl@0
   965
			}
sl@0
   966
		}
sl@0
   967
	DP_OUT();
sl@0
   968
	}
sl@0
   969
sl@0
   970
// HELPER CLASS
sl@0
   971
// ---------------------------------------------------------------------------
sl@0
   972
// from class MGainHelper
sl@0
   973
// CAudioCodec::GetGain
sl@0
   974
// ---------------------------------------------------------------------------
sl@0
   975
TInt CAudioCodec::GetGain(TInt& aGain) const
sl@0
   976
	{
sl@0
   977
	DP_CONTEXT(CAudioCodec::GetGain *CD1*, CtxDevSound, DPLOCAL);
sl@0
   978
	DP_IN();
sl@0
   979
	TInt err = KErrNone;
sl@0
   980
	if (iMode == EDecode  && iPlayCustomInterface)
sl@0
   981
		{
sl@0
   982
		aGain = iPlayCustomInterface->Volume();
sl@0
   983
		}
sl@0
   984
	else if( iMode == EEncode  && iRecordCustomInterface) 
sl@0
   985
		{
sl@0
   986
		aGain = iRecordCustomInterface->Gain();
sl@0
   987
		}
sl@0
   988
	DP0_RET(err, "%d");
sl@0
   989
	}
sl@0
   990
sl@0
   991
// ---------------------------------------------------------------------------
sl@0
   992
// from class MGainHelper
sl@0
   993
// CAudioCodec::SetGain
sl@0
   994
// ---------------------------------------------------------------------------
sl@0
   995
TInt CAudioCodec::SetGain(RArray<TAudioChannelGain>& aChannels)
sl@0
   996
	{
sl@0
   997
	DP_CONTEXT(CAudioCodec::SetGain *CD1*, CtxDevSound, DPLOCAL);
sl@0
   998
	DP_IN();
sl@0
   999
	TInt err = KErrNone;
sl@0
  1000
sl@0
  1001
	// Current adaptation doesn't support multichannel
sl@0
  1002
	// Use average
sl@0
  1003
	TUint count = aChannels.Count();
sl@0
  1004
	TInt gain = 0;
sl@0
  1005
	if (count)
sl@0
  1006
		{
sl@0
  1007
		TInt totalGain = 0;
sl@0
  1008
		for (TUint i(0); i < count; i++)
sl@0
  1009
			{
sl@0
  1010
			totalGain  =+ aChannels[i].iGain;
sl@0
  1011
			}
sl@0
  1012
		gain = totalGain / count;
sl@0
  1013
		}
sl@0
  1014
sl@0
  1015
	if (gain > KDefaultMaxGain)
sl@0
  1016
		{
sl@0
  1017
		gain = KDefaultMaxGain;
sl@0
  1018
		}
sl@0
  1019
	else if (gain < 0)
sl@0
  1020
		{
sl@0
  1021
		gain = 0;
sl@0
  1022
		}
sl@0
  1023
sl@0
  1024
	if (iMode == EDecode  && iPlayCustomInterface)
sl@0
  1025
		{
sl@0
  1026
		iPlayCustomInterface->SetVolume(gain);
sl@0
  1027
		}
sl@0
  1028
	else if( iMode == EEncode  && iRecordCustomInterface) 
sl@0
  1029
		{
sl@0
  1030
		iRecordCustomInterface->SetGain(gain);
sl@0
  1031
		}
sl@0
  1032
	
sl@0
  1033
	DP0_RET(err, "%d");
sl@0
  1034
		}
sl@0
  1035
sl@0
  1036
sl@0
  1037
TInt CAudioCodec::ConfigureRamp(TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration)
sl@0
  1038
	{
sl@0
  1039
	DP_CONTEXT(CAudioCodec::ConfigureRamp *CD1*, CtxDevSound, DPLOCAL);
sl@0
  1040
	DP_IN();
sl@0
  1041
	TInt err = KErrNone;
sl@0
  1042
sl@0
  1043
	if (aRampOperation == KUidGainSawTooth)
sl@0
  1044
		{
sl@0
  1045
		if (iMode == EDecode  && iPlayCustomInterface)
sl@0
  1046
			{
sl@0
  1047
			iPlayCustomInterface->SetVolumeRamp(aRampDuration);
sl@0
  1048
			}
sl@0
  1049
		}
sl@0
  1050
	else if (iRampOperation == KNullUid)
sl@0
  1051
		{
sl@0
  1052
		if (iMode == EDecode  && iPlayCustomInterface)
sl@0
  1053
			{
sl@0
  1054
			iPlayCustomInterface->SetVolumeRamp(0);
sl@0
  1055
			}
sl@0
  1056
		}
sl@0
  1057
	else
sl@0
  1058
		{
sl@0
  1059
		err = KErrA3fUnsupportedRamp;
sl@0
  1060
		}
sl@0
  1061
sl@0
  1062
	DP0_RET(err, "%d");
sl@0
  1063
	}
sl@0
  1064
sl@0
  1065
// ---------------------------------------------------------------------------
sl@0
  1066
// from class MPositionControl
sl@0
  1067
// CAudioCodec::GetControlPosition
sl@0
  1068
// ---------------------------------------------------------------------------
sl@0
  1069
TInt CAudioCodec::GetControlPosition(TTimeIntervalMicroSeconds& aPosition)
sl@0
  1070
	{
sl@0
  1071
	DP_CONTEXT(CAudioCodec::GetControlPosition *CD1*, CtxDevSound, DPLOCAL);
sl@0
  1072
	DP_IN();
sl@0
  1073
	TInt err = KErrNone;
sl@0
  1074
	TInt sampleRateValue = iSampleRateConfig;
sl@0
  1075
sl@0
  1076
	// At this adaptation EMMFSoundEncoding16BitPCM encoding is assumed
sl@0
  1077
	// Due RMdaDevSound which is always pcm16 each sample is 2 bytes
sl@0
  1078
	TInt bytesPerAudioSample = 2;
sl@0
  1079
sl@0
  1080
	// Here is secure to convert to TInt a TAudioMode since the values 
sl@0
  1081
	// are chossen according to the value they represent.
sl@0
  1082
	TInt numberOfChannels = ResolveMode(iModeConfig);
sl@0
  1083
sl@0
  1084
	TInt64 samples = 0;
sl@0
  1085
	if (err == KErrNone)
sl@0
  1086
		{
sl@0
  1087
		if( iMode == EDecode && iPlayCustomInterface)
sl@0
  1088
			{
sl@0
  1089
			TInt64 bytesPlayed = iPlayCustomInterface->BytesPlayed();
sl@0
  1090
			if (bytesPlayed)
sl@0
  1091
				{
sl@0
  1092
				iPlayedBytesCount = bytesPlayed;
sl@0
  1093
				}
sl@0
  1094
sl@0
  1095
			samples = iPlayedBytesCount;
sl@0
  1096
sl@0
  1097
			if(numberOfChannels > 1)
sl@0
  1098
				{
sl@0
  1099
				samples /= numberOfChannels;
sl@0
  1100
				}
sl@0
  1101
sl@0
  1102
			if(bytesPerAudioSample > 1)
sl@0
  1103
				{
sl@0
  1104
				samples /= bytesPerAudioSample;
sl@0
  1105
				}
sl@0
  1106
			}
sl@0
  1107
		else if( iMode == EEncode && iRecordCustomInterface)
sl@0
  1108
			{
sl@0
  1109
			samples = iRecordCustomInterface->BytesRecorded();
sl@0
  1110
			if(numberOfChannels > 1)
sl@0
  1111
				{
sl@0
  1112
				samples /= numberOfChannels;
sl@0
  1113
				}
sl@0
  1114
			if(bytesPerAudioSample > 1)
sl@0
  1115
				{
sl@0
  1116
				samples /= bytesPerAudioSample;
sl@0
  1117
				}
sl@0
  1118
			}
sl@0
  1119
		}
sl@0
  1120
sl@0
  1121
	if(sampleRateValue)
sl@0
  1122
		{
sl@0
  1123
		iPosition = (TInt64(samples) * KMicroSecsInOneSec / sampleRateValue);
sl@0
  1124
		}
sl@0
  1125
	aPosition = iPosition;
sl@0
  1126
	DP1(DLINFO,"GetControlPosition Samples = %d", samples);
sl@0
  1127
#ifdef _DEBUG
sl@0
  1128
	RDebug::Print(_L("GetControlPosition Position=%d"), iPosition);
sl@0
  1129
#endif 
sl@0
  1130
	DP0_RET(err, "%d");
sl@0
  1131
	}
sl@0
  1132
sl@0
  1133
// ---------------------------------------------------------------------------
sl@0
  1134
// CAudioCodec::ResetControlPosition
sl@0
  1135
// ---------------------------------------------------------------------------
sl@0
  1136
void CAudioCodec::ResetControlPosition()
sl@0
  1137
	{
sl@0
  1138
	DP_CONTEXT(CAudioCodec::ResetControlPosition *CD1*, CtxDevSound, DPLOCAL);
sl@0
  1139
	DP_IN();
sl@0
  1140
	iPosition = 0;
sl@0
  1141
	iPlayedBytesCount = 0;
sl@0
  1142
	DP_OUT();
sl@0
  1143
	}
sl@0
  1144
sl@0
  1145
// ---------------------------------------------------------------------------
sl@0
  1146
// CAudioCodec::FourCCToHwDeviceUid
sl@0
  1147
// ---------------------------------------------------------------------------
sl@0
  1148
void CAudioCodec::FourCCToHwDeviceUidL(TFourCC aFourCC, TMode aMode, TUid &aHWDev)
sl@0
  1149
	{
sl@0
  1150
	DP_CONTEXT(CAudioCodec::FourCCToHwDeviceUid *CD1*, CtxDevSound, DPLOCAL);
sl@0
  1151
	DP_IN();
sl@0
  1152
			
sl@0
  1153
	//check argument precondition for aState
sl@0
  1154
	if ((aMode != EDecode) && (aMode != EEncode))
sl@0
  1155
		{
sl@0
  1156
		User::Leave(KErrArgument);
sl@0
  1157
		}
sl@0
  1158
sl@0
  1159
	// Array to return hw device plugin resource info(place on cleanupstack
sl@0
  1160
	// _after_ ListImplementationsL() )
sl@0
  1161
	RImplInfoPtrArray plugInArray;
sl@0
  1162
	TUid KUidMmfHWPluginInterfaceCodec = {KMmfUidPluginInterfaceHwDevice};
sl@0
  1163
sl@0
  1164
	// ListImplementationsL leaves if it cannot find anything so trap the error
sl@0
  1165
	TRAPD(err, REComSession::ListImplementationsL(KUidMmfHWPluginInterfaceCodec,
sl@0
  1166
													plugInArray));
sl@0
  1167
	CleanupResetAndDestroyPushL(plugInArray);	
sl@0
  1168
sl@0
  1169
	TUint numberOfHwDevicePlugins = plugInArray.Count();
sl@0
  1170
sl@0
  1171
	// if no errors and have hwdevice plugin resource entries then scan entries
sl@0
  1172
	// matching on a datatype of pcm16 as the destination datatype for play and
sl@0
  1173
	// the source datatype for record. If a match is found and isn't already in
sl@0
  1174
	// the list of supported data types, then add it to the list
sl@0
  1175
	if ((err == KErrNone) && (numberOfHwDevicePlugins))
sl@0
  1176
		{
sl@0
  1177
		CImplementationInformation* hwDeviceResourceEntry = NULL;
sl@0
  1178
		_LIT8(KPCM16FourCCString, " P16");
sl@0
  1179
		TBufC8<KFOURCCLENGTH> fourCCStringPCM16(KPCM16FourCCString);
sl@0
  1180
		TPtr8 fourCCPtrPCM16 = fourCCStringPCM16.Des();
sl@0
  1181
sl@0
  1182
		// check each resource entry for dst 4CC = P16 for play and
sl@0
  1183
		// src 4CC = P16 for record
sl@0
  1184
		for (TUint hwDeviceEntry = 0;
sl@0
  1185
				hwDeviceEntry < numberOfHwDevicePlugins;
sl@0
  1186
				hwDeviceEntry++)
sl@0
  1187
			{
sl@0
  1188
			hwDeviceResourceEntry = plugInArray[hwDeviceEntry];
sl@0
  1189
sl@0
  1190
			if (IsDataTypeMatch(hwDeviceResourceEntry, fourCCPtrPCM16, aMode))
sl@0
  1191
				{
sl@0
  1192
				// resource entry data field has dest/src datatype ' P16'
sl@0
  1193
				// i.e. pcm16 for play/record
sl@0
  1194
				TPtrC8 fourCCPtr(0,0);
sl@0
  1195
sl@0
  1196
				if (aMode == EDecode)
sl@0
  1197
					{
sl@0
  1198
					// datatype supported 4CC is left 4 chars
sl@0
  1199
					fourCCPtr.Set(
sl@0
  1200
					hwDeviceResourceEntry->DataType().Left(KFOURCCLENGTH));
sl@0
  1201
					}
sl@0
  1202
				else if (aMode == EEncode)
sl@0
  1203
					{
sl@0
  1204
					// datatype supported 4CC is right 4 chars
sl@0
  1205
					fourCCPtr.Set(
sl@0
  1206
					hwDeviceResourceEntry->DataType().Right(KFOURCCLENGTH));
sl@0
  1207
					}
sl@0
  1208
sl@0
  1209
				TFourCC fourCCEntry(fourCCPtr);
sl@0
  1210
sl@0
  1211
				// New Mapping
sl@0
  1212
				if (fourCCEntry == aFourCC)
sl@0
  1213
					{
sl@0
  1214
					// get the Uid
sl@0
  1215
					aHWDev = hwDeviceResourceEntry->ImplementationUid();
sl@0
  1216
					break;
sl@0
  1217
					}
sl@0
  1218
				}
sl@0
  1219
			}
sl@0
  1220
			
sl@0
  1221
		// Verify there is a HwDeviceUid
sl@0
  1222
		if(aHWDev.iUid == 0)
sl@0
  1223
			{
sl@0
  1224
			User::Leave(KErrNotSupported);
sl@0
  1225
			}
sl@0
  1226
		}
sl@0
  1227
	else
sl@0
  1228
		{
sl@0
  1229
		// if an error occured and not KErrNotFound then must be a 'real' error
sl@0
  1230
		// e.g. KErrNoMemory
sl@0
  1231
		if ((err != KErrNotFound) && (err != KErrNone))
sl@0
  1232
			{
sl@0
  1233
			User::Leave(err);
sl@0
  1234
			}
sl@0
  1235
		}
sl@0
  1236
sl@0
  1237
	CleanupStack::PopAndDestroy(&plugInArray);
sl@0
  1238
	DP_OUT();
sl@0
  1239
	}
sl@0
  1240
sl@0
  1241
// ---------------------------------------------------------------------------
sl@0
  1242
// CAudioCodec::IsDataTypeMatch
sl@0
  1243
// ---------------------------------------------------------------------------
sl@0
  1244
TBool CAudioCodec::IsDataTypeMatch(CImplementationInformation* aHwDeviceResourceEntry,
sl@0
  1245
	const TDesC8& aHwMatchFourCC, TMode aState)
sl@0
  1246
	{
sl@0
  1247
	DP_CONTEXT(CAudioCodec::IsDataTypeMatch *CD1*, CtxDevSound, DPLOCAL);
sl@0
  1248
	DP_IN();
sl@0
  1249
	TBool match = EFalse;
sl@0
  1250
sl@0
  1251
	// Check for resource entry lenght since for HwDeviceAdaptor it is just "*"
sl@0
  1252
	if (aHwDeviceResourceEntry->DataType().Length()>=KHwDeviceDefaultDataLength)
sl@0
  1253
		{
sl@0
  1254
		if (aState == EDecode)
sl@0
  1255
			{
sl@0
  1256
			//play need to match with the right four characters
sl@0
  1257
			match = (!(aHwMatchFourCC.Match(
sl@0
  1258
				aHwDeviceResourceEntry->DataType().Right(KFOURCCLENGTH)) ==
sl@0
  1259
				KErrNotFound));
sl@0
  1260
			}
sl@0
  1261
		else if (aState == EEncode)
sl@0
  1262
			{
sl@0
  1263
			//record need to match with the left four characters
sl@0
  1264
			match =
sl@0
  1265
				(!(aHwMatchFourCC.Match(
sl@0
  1266
				aHwDeviceResourceEntry->DataType().Left(KFOURCCLENGTH)) ==
sl@0
  1267
				KErrNotFound));
sl@0
  1268
			}
sl@0
  1269
		}
sl@0
  1270
	else
sl@0
  1271
		{
sl@0
  1272
#ifdef _DEBUG
sl@0
  1273
		RDebug::Print(_L("HwDeviceEntry %S"), &aHwDeviceResourceEntry->DataType());
sl@0
  1274
#endif			
sl@0
  1275
		}
sl@0
  1276
sl@0
  1277
	DP0_RET(match, "0x%x");
sl@0
  1278
	}
sl@0
  1279
sl@0
  1280
// ---------------------------------------------------------------------------
sl@0
  1281
// CAudioCodec::ResolveMode
sl@0
  1282
// ---------------------------------------------------------------------------
sl@0
  1283
TInt CAudioCodec::ResolveMode(TUid aMode)
sl@0
  1284
	{
sl@0
  1285
	DP_CONTEXT(CAudioCodec::ResolveMode *CD1*, CtxDevSound, DPLOCAL);
sl@0
  1286
	DP_IN();
sl@0
  1287
	TInt result = 0;
sl@0
  1288
sl@0
  1289
	//Mapping an uid mode to an int channel
sl@0
  1290
	for (TUint i=0; i<=KMaxModeIndex; i++)
sl@0
  1291
		{
sl@0
  1292
		if(KModeTableLookup[i].iAudioMode == aMode)
sl@0
  1293
			{
sl@0
  1294
			result = KModeTableLookup[i].iAudioModeValue;
sl@0
  1295
			break;
sl@0
  1296
			}
sl@0
  1297
		}
sl@0
  1298
	DP0_RET(result, "%d");
sl@0
  1299
	}
sl@0
  1300
sl@0
  1301
// ---------------------------------------------------------------------------
sl@0
  1302
// CAudioCodec::SupportedRates
sl@0
  1303
// ---------------------------------------------------------------------------
sl@0
  1304
EXPORT_C TInt CAudioCodec::SupportedRates(RArray<TInt>& aSupportedRates)
sl@0
  1305
	{
sl@0
  1306
	DP_CONTEXT(CAudioCodec::Service *CD1*, CtxDevSound, DPLOCAL);
sl@0
  1307
	DP_IN();
sl@0
  1308
	iRequest |= KRequestSampleRate;
sl@0
  1309
sl@0
  1310
	//Get request capabilities
sl@0
  1311
	iErrorRates = GetSupportedSampleRates(aSupportedRates);
sl@0
  1312
	
sl@0
  1313
	// Simulate an asyncronous response
sl@0
  1314
	if (!IsActive())
sl@0
  1315
		{
sl@0
  1316
		TRequestStatus* status = &iStatus;
sl@0
  1317
		User::RequestComplete(status, KErrNone);
sl@0
  1318
		SetActive();
sl@0
  1319
		}
sl@0
  1320
	DP0_RET(iErrorRates, "%d");
sl@0
  1321
	}
sl@0
  1322
sl@0
  1323
// ---------------------------------------------------------------------------
sl@0
  1324
// CAudioCodec::SupportedModes
sl@0
  1325
// ---------------------------------------------------------------------------
sl@0
  1326
EXPORT_C TInt CAudioCodec::SupportedModes(RArray<TUid>& aSupportedModes)
sl@0
  1327
	{
sl@0
  1328
	DP_CONTEXT(CAudioCodec::Service *CD1*, CtxDevSound, DPLOCAL);
sl@0
  1329
	DP_IN();
sl@0
  1330
	iRequest |= KRequestMode;
sl@0
  1331
sl@0
  1332
	iErrorModes = GetSupportedModes(aSupportedModes);
sl@0
  1333
sl@0
  1334
	// Simulate an asyncronous response
sl@0
  1335
	if (!IsActive())
sl@0
  1336
		{
sl@0
  1337
		TRequestStatus* status = &iStatus;
sl@0
  1338
		User::RequestComplete(status, KErrNone);
sl@0
  1339
		SetActive();
sl@0
  1340
		}
sl@0
  1341
	DP0_RET(iErrorModes, "%d");
sl@0
  1342
	}
sl@0
  1343
sl@0
  1344
sl@0
  1345
//From CActive
sl@0
  1346
// ---------------------------------------------------------------------------
sl@0
  1347
// CAudioCodec::RunL
sl@0
  1348
// ---------------------------------------------------------------------------
sl@0
  1349
void CAudioCodec::RunL()
sl@0
  1350
	{
sl@0
  1351
	DP_CONTEXT(CAudioCodec::RunL *CD1*, CtxDevSound, DPLOCAL);
sl@0
  1352
	DP_IN();
sl@0
  1353
sl@0
  1354
	// Send the callback for the request operation
sl@0
  1355
	if (iRequest & KRequestMode)
sl@0
  1356
		{
sl@0
  1357
		TUint count = iAudioCodecObservers.Count();
sl@0
  1358
		for ( TUint i(0); i < count; i++ )
sl@0
  1359
			{
sl@0
  1360
			iAudioCodecObservers[i]->GetSupportedAModesComplete(iErrorModes);
sl@0
  1361
			}
sl@0
  1362
sl@0
  1363
		// Reset the request flag
sl@0
  1364
		iRequest &= ~KRequestMode;
sl@0
  1365
		}
sl@0
  1366
sl@0
  1367
	// Send the callback for the request operation
sl@0
  1368
	if (iRequest & KRequestSampleRate)
sl@0
  1369
		{
sl@0
  1370
		TUint count = iAudioCodecObservers.Count();
sl@0
  1371
		for ( TUint i(0); i < count; i++ )
sl@0
  1372
			{
sl@0
  1373
			iAudioCodecObservers[i]->GetSupportedARatesComplete(iErrorRates);
sl@0
  1374
			}
sl@0
  1375
sl@0
  1376
		// Reset the request flag
sl@0
  1377
		iRequest &= ~KRequestSampleRate;
sl@0
  1378
		}
sl@0
  1379
sl@0
  1380
	DP_OUT();
sl@0
  1381
	}
sl@0
  1382
sl@0
  1383
// ---------------------------------------------------------------------------
sl@0
  1384
// CAudioCodec::RunError
sl@0
  1385
// ---------------------------------------------------------------------------
sl@0
  1386
TInt CAudioCodec::RunError(TInt aError)
sl@0
  1387
	{
sl@0
  1388
	DP_CONTEXT(CAudioCodec::RunError *CD1*, CtxDevSound, DPLOCAL);
sl@0
  1389
	DP_IN();
sl@0
  1390
	DP0_RET(aError, "%d");
sl@0
  1391
	}
sl@0
  1392
sl@0
  1393
// ---------------------------------------------------------------------------
sl@0
  1394
// CAudioCodec::DoCancel
sl@0
  1395
// ---------------------------------------------------------------------------
sl@0
  1396
void CAudioCodec::DoCancel()
sl@0
  1397
	{
sl@0
  1398
	DP_CONTEXT(CAudioCodec::DoCancel *CD1*, CtxDevSound, DPLOCAL);
sl@0
  1399
	DP_IN();
sl@0
  1400
	iRequest = 0;
sl@0
  1401
	DP_OUT();
sl@0
  1402
	}
sl@0
  1403
sl@0
  1404
// end of file