os/mm/devsound/sounddevbt/PlatSec/src/SoundDevice/BtSoundDeviceBody.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2001-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/plugin/mmfbthwdeviceimplementationuids.hrh>
sl@0
    17
#include "BtSoundDeviceBody.h"
sl@0
    18
#include <mmf/server/mmfbtswcodecwrappercustominterfacesuids.hrh> // KUidBtRefDevSoundTaskConfig
sl@0
    19
#include "MmfBtFileDependencyUtil.h"
sl@0
    20
sl@0
    21
/*
sl@0
    22
 *
sl@0
    23
 *	Default Constructor.
sl@0
    24
 *
sl@0
    25
 *	No default implementation. CMMFDevSound implements 2-phase construction.
sl@0
    26
 *
sl@0
    27
 */
sl@0
    28
CMMFDevSoundClientImp::CMMFDevSoundClientImp()
sl@0
    29
	{
sl@0
    30
	}
sl@0
    31
sl@0
    32
/*
sl@0
    33
 *
sl@0
    34
 *	Destructor.
sl@0
    35
 *
sl@0
    36
 *	Deletes all objects and releases all resource owned by this
sl@0
    37
 *	instance.
sl@0
    38
 *
sl@0
    39
 */
sl@0
    40
CMMFDevSoundClientImp::~CMMFDevSoundClientImp()
sl@0
    41
	{
sl@0
    42
	CancelCalbackHandlers();
sl@0
    43
	
sl@0
    44
	delete iBTBFHandler; 
sl@0
    45
	delete iPEHandler;
sl@0
    46
	delete iREHandler;
sl@0
    47
	delete iTFHandler;
sl@0
    48
	delete iBTBEHandler;
sl@0
    49
	delete iSETCHandler;
sl@0
    50
	delete iICHandler;
sl@0
    51
sl@0
    52
	if( iDevSoundProxy != NULL)
sl@0
    53
		{
sl@0
    54
		iDevSoundProxy->Close();
sl@0
    55
		delete iDevSoundProxy;
sl@0
    56
		}
sl@0
    57
	}
sl@0
    58
sl@0
    59
/*
sl@0
    60
 *
sl@0
    61
 *	Constructs, and returns a pointer to, a new CMMFDevSound object.
sl@0
    62
 *
sl@0
    63
 *	Leaves on failure.
sl@0
    64
 *
sl@0
    65
 */
sl@0
    66
CMMFDevSoundClientImp* CMMFDevSoundClientImp::NewL()
sl@0
    67
	{
sl@0
    68
	FileDependencyUtil::CheckFileDependencyL();
sl@0
    69
sl@0
    70
	CMMFDevSoundClientImp* self = new (ELeave) CMMFDevSoundClientImp();
sl@0
    71
	CleanupStack::PushL(self);
sl@0
    72
	self->ConstructL();
sl@0
    73
	CleanupStack::Pop(self);
sl@0
    74
	return self;
sl@0
    75
	}
sl@0
    76
sl@0
    77
/*
sl@0
    78
 *
sl@0
    79
 *	3rd phase constructor - assumes that iParent has already been set up properly
sl@0
    80
 *                          (During ConstructL() it has yet to be
sl@0
    81
 *
sl@0
    82
 */
sl@0
    83
void CMMFDevSoundClientImp::ConstructL()
sl@0
    84
	{
sl@0
    85
	// all these data properties should be NULL, but add ASSERTs to verity
sl@0
    86
sl@0
    87
	ASSERT(iDevSoundProxy==NULL);
sl@0
    88
	iDevSoundProxy = new (ELeave) RMMFDevSoundProxy();
sl@0
    89
sl@0
    90
	TInt err = iDevSoundProxy->Open();
sl@0
    91
	if(err)
sl@0
    92
		{
sl@0
    93
		delete iDevSoundProxy;
sl@0
    94
		iDevSoundProxy = NULL;
sl@0
    95
		}
sl@0
    96
sl@0
    97
	User::LeaveIfError(err);
sl@0
    98
	}
sl@0
    99
sl@0
   100
/*
sl@0
   101
 *  @prototype
sl@0
   102
 */
sl@0
   103
void CMMFDevSoundClientImp::CancelCalbackHandlers()
sl@0
   104
	{	
sl@0
   105
	if(iBTBFHandler)
sl@0
   106
		iBTBFHandler->CancelReceiveEvents();
sl@0
   107
	if(iPEHandler)
sl@0
   108
		iPEHandler->CancelReceiveEvents();
sl@0
   109
	if(iREHandler)
sl@0
   110
		iREHandler->CancelReceiveEvents();
sl@0
   111
	if(iTFHandler)
sl@0
   112
		iTFHandler->CancelReceiveEvents();
sl@0
   113
	if(iBTBEHandler)
sl@0
   114
		iBTBEHandler->CancelReceiveEvents();
sl@0
   115
	if(iSETCHandler)
sl@0
   116
		iSETCHandler->CancelReceiveEvents();
sl@0
   117
	if(iICHandler)
sl@0
   118
		iICHandler->CancelReceiveEvents();
sl@0
   119
	}
sl@0
   120
sl@0
   121
/*
sl@0
   122
 *
sl@0
   123
 *	Initializes CMMFDevSound object to play and record PCM16 raw audio data
sl@0
   124
 *	with sampling rate of 8 KHz.
sl@0
   125
 *
sl@0
   126
 *	On completion of Initialization, calls InitializeComplete() on
sl@0
   127
 *	aDevSoundObserver.
sl@0
   128
 *
sl@0
   129
 *	Leaves on failure.
sl@0
   130
 *
sl@0
   131
 *	@param	"MDevSoundObserver& aDevSoundObserver"
sl@0
   132
 *			A reference to DevSound Observer instance.
sl@0
   133
 *
sl@0
   134
 *	@param	"TMMFState aMode"
sl@0
   135
 *			Mode for which this object will be used.
sl@0
   136
 *
sl@0
   137
 */
sl@0
   138
void CMMFDevSoundClientImp::InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode)
sl@0
   139
sl@0
   140
	{
sl@0
   141
	TInt initError = KErrNone;
sl@0
   142
	iDevSoundObserver = &aDevSoundObserver;
sl@0
   143
sl@0
   144
	// Need to set up an init complete event and message handler
sl@0
   145
	// prior to calling InitializeL()
sl@0
   146
	if (iICHandler)
sl@0
   147
		{
sl@0
   148
		iICHandler->CancelReceiveEvents();
sl@0
   149
		}
sl@0
   150
	else
sl@0
   151
		{
sl@0
   152
		iICHandler = CMMFInitializeCompleteHandler::NewL(iDevSoundProxy, *iDevSoundObserver);
sl@0
   153
		}
sl@0
   154
	iICHandler->ReceiveEvents();
sl@0
   155
sl@0
   156
	initError = iDevSoundProxy->InitializeL(aMode);
sl@0
   157
	
sl@0
   158
	if (initError)
sl@0
   159
		{		
sl@0
   160
		iDevSoundObserver->InitializeComplete(initError);
sl@0
   161
		User::Leave(initError);
sl@0
   162
		}
sl@0
   163
sl@0
   164
    if(iBTBFHandler)
sl@0
   165
		{
sl@0
   166
		iBTBFHandler->CancelReceiveEvents();
sl@0
   167
		}
sl@0
   168
	else
sl@0
   169
		{
sl@0
   170
		iBTBFHandler = CMMFBufferToBeFilledHandler::NewL(iDevSoundProxy, *iDevSoundObserver);
sl@0
   171
		}
sl@0
   172
	iBTBFHandler->ReceiveEvents();
sl@0
   173
sl@0
   174
sl@0
   175
    if(iPEHandler)
sl@0
   176
		{
sl@0
   177
		iPEHandler->CancelReceiveEvents();
sl@0
   178
		}
sl@0
   179
	else
sl@0
   180
		{
sl@0
   181
		iPEHandler = CMMFPlayErrorHandler::NewL(iDevSoundProxy, *iDevSoundObserver);
sl@0
   182
		}
sl@0
   183
	iPEHandler->ReceiveEvents();
sl@0
   184
sl@0
   185
sl@0
   186
    if(iREHandler)
sl@0
   187
		{
sl@0
   188
		iREHandler->CancelReceiveEvents();
sl@0
   189
		}
sl@0
   190
	else
sl@0
   191
		{
sl@0
   192
		iREHandler = CMMFRecordErrorHandler::NewL(iDevSoundProxy, *iDevSoundObserver);
sl@0
   193
		}
sl@0
   194
	iREHandler->ReceiveEvents();
sl@0
   195
sl@0
   196
sl@0
   197
    if(iTFHandler)
sl@0
   198
		{
sl@0
   199
		iTFHandler->CancelReceiveEvents();
sl@0
   200
		}
sl@0
   201
	else
sl@0
   202
		{
sl@0
   203
		iTFHandler = CMMFToneFinishedHandler::NewL(iDevSoundProxy, *iDevSoundObserver);
sl@0
   204
		}
sl@0
   205
	iTFHandler->ReceiveEvents();
sl@0
   206
sl@0
   207
sl@0
   208
    if(iBTBEHandler)
sl@0
   209
		{
sl@0
   210
		iBTBEHandler->CancelReceiveEvents();
sl@0
   211
		}
sl@0
   212
	else
sl@0
   213
		{
sl@0
   214
		iBTBEHandler = CMMFBufferToBeEmptiedHandler::NewL(iDevSoundProxy, *iDevSoundObserver);
sl@0
   215
		}
sl@0
   216
	iBTBEHandler->ReceiveEvents();
sl@0
   217
sl@0
   218
sl@0
   219
    if(iSETCHandler)
sl@0
   220
		{
sl@0
   221
		iSETCHandler->CancelReceiveEvents();
sl@0
   222
		}
sl@0
   223
	else
sl@0
   224
		{
sl@0
   225
		iSETCHandler = CMMFSendEventToClientHandler::NewL(iDevSoundProxy, *iDevSoundObserver);
sl@0
   226
		}
sl@0
   227
	iSETCHandler->ReceiveEvents();
sl@0
   228
	}
sl@0
   229
sl@0
   230
/*
sl@0
   231
 *
sl@0
   232
 *	Configure CMMFDevSound object for the settings in aConfig.
sl@0
   233
 *
sl@0
   234
 *	Use this to set sampling rate, Encoding and Mono/Stereo.
sl@0
   235
 *
sl@0
   236
 *	@param	"TMMFCapabilities& aConfig"
sl@0
   237
 *			Attribute values to which CMMFDevSound object will be configured to.
sl@0
   238
 *
sl@0
   239
 *  As part of defect 20796, the iRecordFormat has been set under the iPlayFormat, 
sl@0
   240
 *  before it was not set at all.
sl@0
   241
 *
sl@0
   242
 */
sl@0
   243
void CMMFDevSoundClientImp::SetConfigL(const TMMFCapabilities& aConfig)
sl@0
   244
	{
sl@0
   245
	iDevSoundProxy->SetConfigL(aConfig);
sl@0
   246
	}
sl@0
   247
sl@0
   248
/*
sl@0
   249
 *
sl@0
   250
 *	Changes the current playback volume to a specified value.
sl@0
   251
 *
sl@0
   252
 *	The volume can be changed before or during playback and is effective
sl@0
   253
 *	immediately.
sl@0
   254
 *
sl@0
   255
 *	@param	"TInt aVolume"
sl@0
   256
 *			The volume setting. This can be any value from zero to the value
sl@0
   257
 *			returned by a call to CMdaAudioPlayerUtility::MaxVolume(). If the
sl@0
   258
 *			volume is not within this range, the volume is automatically set to
sl@0
   259
 *			minimum or maximum value based on the value that is being passed.
sl@0
   260
 *			Setting a zero value mutes the sound. Setting the maximum value
sl@0
   261
 *			results in the loudest possible sound.
sl@0
   262
 *
sl@0
   263
 */
sl@0
   264
void CMMFDevSoundClientImp::SetVolume(TInt aVolume)
sl@0
   265
	{
sl@0
   266
	iDevSoundProxy->SetVolume(aVolume);
sl@0
   267
	}
sl@0
   268
sl@0
   269
/*
sl@0
   270
 *
sl@0
   271
 *	Changes the current recording gain to a specified value.
sl@0
   272
 *
sl@0
   273
 *	The gain can be changed before or during recording and is effective
sl@0
   274
 *	immediately.
sl@0
   275
 *
sl@0
   276
 *	@param	"TInt aGain"
sl@0
   277
 *			The volume setting. This can be any value from zero to the value
sl@0
   278
 *			returned by a call to CMdaAudioPlayerUtility::MaxVolume(). If the
sl@0
   279
 *			volume is not within this range, the gain is automatically set to
sl@0
   280
 *			minimum or maximum value based on the value that is being passed.
sl@0
   281
 *			Setting a zero value mutes the sound. Setting the maximum value
sl@0
   282
 *			results in the loudest possible sound.
sl@0
   283
 *
sl@0
   284
 */
sl@0
   285
void CMMFDevSoundClientImp::SetGain(TInt aGain)
sl@0
   286
	{
sl@0
   287
	iDevSoundProxy->SetGain(aGain);
sl@0
   288
	}
sl@0
   289
sl@0
   290
/*
sl@0
   291
 *
sl@0
   292
 *	Sets the speaker balance for playing.
sl@0
   293
 *
sl@0
   294
 *	The speaker balance can be changed before or during playback and is
sl@0
   295
 *	effective immediately.
sl@0
   296
 *
sl@0
   297
 *	@param	"TInt& aLeftPercentage"
sl@0
   298
 *			On return contains left speaker volume perecentage. This can be any
sl@0
   299
 *			value from zero to 100. Setting a zero value mutes the sound on left
sl@0
   300
 *			speaker.
sl@0
   301
 *
sl@0
   302
 *	@param	"TInt& aRightPercentage"
sl@0
   303
 *			On return contains right speaker volume perecentage. This can be any
sl@0
   304
 *			value from zero to 100. Setting a zero value mutes the sound on
sl@0
   305
 *			right speaker.
sl@0
   306
 *
sl@0
   307
 */
sl@0
   308
void CMMFDevSoundClientImp::SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage)
sl@0
   309
	{
sl@0
   310
	iDevSoundProxy->SetPlayBalanceL(aLeftPercentage, aRightPercentage);
sl@0
   311
	}
sl@0
   312
sl@0
   313
/*
sl@0
   314
 *
sl@0
   315
 *	Sets the microphone gain balance for recording.
sl@0
   316
 *
sl@0
   317
 *	The microphone gain balance can be changed before or during recording and
sl@0
   318
 *	is effective immediately.
sl@0
   319
 *
sl@0
   320
 *	@param	"TInt aLeftPercentage"
sl@0
   321
 *			Left microphone gain precentage. This can be any value from zero to
sl@0
   322
 *			100. Setting a zero value mutes the gain on left microphone.
sl@0
   323
 *
sl@0
   324
 *	@param	"TInt aRightPercentage"
sl@0
   325
 *			Right microphone gain precentage. This can be any value from zero to
sl@0
   326
 *			100. Setting a zero value mutes the gain on right microphone.
sl@0
   327
 *
sl@0
   328
 */
sl@0
   329
void CMMFDevSoundClientImp::SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage)
sl@0
   330
	{
sl@0
   331
	iDevSoundProxy->SetRecordBalanceL(aLeftPercentage, aRightPercentage);
sl@0
   332
	}
sl@0
   333
sl@0
   334
/*
sl@0
   335
 *
sl@0
   336
 *	Initializes audio device and start play process. This method queries and
sl@0
   337
 *	acquires the audio policy before initializing audio device. If there was an
sl@0
   338
 *	error during policy initialization, PlayError() method will be called on
sl@0
   339
 *	the observer with error code KErrAccessDenied, otherwise BufferToBeFilled()
sl@0
   340
 *	method will be called with a buffer reference. After reading data into the
sl@0
   341
 *	buffer reference passed, the client should call PlayData() to play data.
sl@0
   342
 *
sl@0
   343
 *	The amount of data that can be played is specified in
sl@0
   344
 *	CMMFBuffer::RequestSize(). Any data that is read into buffer beyond this
sl@0
   345
 *	size will be ignored.
sl@0
   346
 *
sl@0
   347
 *	Leaves on failure.
sl@0
   348
 *
sl@0
   349
 */
sl@0
   350
void CMMFDevSoundClientImp::PlayInitL()
sl@0
   351
	{
sl@0
   352
	if (!iDevSoundObserver)
sl@0
   353
		User::Leave(KErrNotReady);
sl@0
   354
	iDevSoundProxy->PlayInitL();
sl@0
   355
	}
sl@0
   356
sl@0
   357
/*
sl@0
   358
 *
sl@0
   359
 *	Initializes audio device and start record process. This method queries and
sl@0
   360
 *	acquires the audio policy before initializing audio device. If there was an
sl@0
   361
 *	error during policy initialization, RecordError() method will be called on
sl@0
   362
 *	the observer with error code KErrAccessDenied, otherwise BufferToBeEmptied()
sl@0
   363
 *	method will be called with a buffer reference. This buffer contains recorded
sl@0
   364
 *	or encoded data. After processing data in the buffer reference passed, the
sl@0
   365
 *	client should call RecordData() to continue recording process.
sl@0
   366
 *
sl@0
   367
 *	The amount of data that is available is specified in
sl@0
   368
 *	CMMFBuffer::RequestSize().
sl@0
   369
 *
sl@0
   370
 *	Leaves on failure.
sl@0
   371
 *
sl@0
   372
 */
sl@0
   373
void CMMFDevSoundClientImp::RecordInitL()
sl@0
   374
	{
sl@0
   375
sl@0
   376
	if (!iDevSoundObserver)
sl@0
   377
		User::Leave(KErrNotReady);
sl@0
   378
	iDevSoundProxy->RecordInitL();
sl@0
   379
	}
sl@0
   380
sl@0
   381
/*
sl@0
   382
 *
sl@0
   383
 *	Plays data in the buffer at the current volume. The client should fill
sl@0
   384
 *	the buffer with audio data before calling this method. The Observer gets
sl@0
   385
 *	reference to buffer along with callback BufferToBeFilled(). When playing of
sl@0
   386
 *	the audio sample is complete, successfully or otherwise, the method
sl@0
   387
 *	PlayError() on observer is called.
sl@0
   388
 *
sl@0
   389
 */
sl@0
   390
void CMMFDevSoundClientImp::PlayData()
sl@0
   391
	{
sl@0
   392
	ASSERT(iDevSoundObserver);
sl@0
   393
	iDevSoundProxy->PlayData();
sl@0
   394
	}
sl@0
   395
sl@0
   396
/*
sl@0
   397
 *
sl@0
   398
 *	Stops the ongoing operation (Play, Record, TonePlay, Convert)
sl@0
   399
 *
sl@0
   400
 */
sl@0
   401
void CMMFDevSoundClientImp::Stop()
sl@0
   402
	{
sl@0
   403
	iDevSoundProxy->Stop();
sl@0
   404
	}
sl@0
   405
sl@0
   406
/*
sl@0
   407
 *
sl@0
   408
 *	Temporarily Stops the ongoing operation (Play, Record, TonePlay, Convert)
sl@0
   409
 *
sl@0
   410
 */
sl@0
   411
void CMMFDevSoundClientImp::Pause()
sl@0
   412
	{
sl@0
   413
	iDevSoundProxy->Pause();
sl@0
   414
	}
sl@0
   415
sl@0
   416
/*
sl@0
   417
 *
sl@0
   418
 *	Returns the sample recorded so far.
sl@0
   419
 *
sl@0
   420
 *	@return "TInt"
sl@0
   421
 *			Returns the samples recorded.
sl@0
   422
 *
sl@0
   423
 */
sl@0
   424
TInt CMMFDevSoundClientImp::SamplesRecorded()
sl@0
   425
	{
sl@0
   426
	return iDevSoundProxy->SamplesRecorded();
sl@0
   427
	}
sl@0
   428
sl@0
   429
/*
sl@0
   430
 *
sl@0
   431
 *	Returns the sample played so far.
sl@0
   432
 *
sl@0
   433
 *	@return "TInt"
sl@0
   434
 *			Returns the samples recorded.
sl@0
   435
 *
sl@0
   436
 */
sl@0
   437
TInt CMMFDevSoundClientImp::SamplesPlayed()
sl@0
   438
	{
sl@0
   439
	return iDevSoundProxy->SamplesPlayed();
sl@0
   440
	}
sl@0
   441
sl@0
   442
sl@0
   443
/*
sl@0
   444
 *
sl@0
   445
 *	Initializes audio device and start playing tone. Tone is played with
sl@0
   446
 *	frequency and for duration specified.
sl@0
   447
 *
sl@0
   448
 *	Leaves on failure.
sl@0
   449
 *
sl@0
   450
 *	@param	"TInt aFrequency"
sl@0
   451
 *			Frequency at with the tone will be played.
sl@0
   452
 *
sl@0
   453
 *	@param	"TTimeIntervalMicroSeconds& aDuration"
sl@0
   454
 *			The period over which the tone will be played. A zero value causes
sl@0
   455
 *			the no tone to be played (Verify this with test app).
sl@0
   456
 *
sl@0
   457
 */
sl@0
   458
void CMMFDevSoundClientImp::PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration)
sl@0
   459
	{
sl@0
   460
	iDevSoundProxy->PlayToneL(aFrequency, aDuration);
sl@0
   461
	}
sl@0
   462
sl@0
   463
/*
sl@0
   464
 *	Initializes audio device and start playing a dual tone. 
sl@0
   465
 *  The tone consists of two sine waves of different frequencies summed together
sl@0
   466
 *  Dual Tone is played with specified frequencies and for specified duration.
sl@0
   467
 *
sl@0
   468
 *	@param	"aFrequencyOne"
sl@0
   469
 *			First frequency of dual tone
sl@0
   470
 *
sl@0
   471
 *	@param	"aFrequencyTwo"
sl@0
   472
 *			Second frequency of dual tone
sl@0
   473
 *
sl@0
   474
 *	@param	"aDuration"
sl@0
   475
 *			The period over which the tone will be played. A zero value causes
sl@0
   476
 *			the no tone to be played (Verify this with test app).
sl@0
   477
 */
sl@0
   478
void CMMFDevSoundClientImp::PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration)
sl@0
   479
	{
sl@0
   480
	iDevSoundProxy->PlayDualToneL(aFrequencyOne, aFrequencyTwo, aDuration);
sl@0
   481
	}
sl@0
   482
sl@0
   483
/*
sl@0
   484
 *
sl@0
   485
 *	Initializes audio device and start playing DTMF string aDTMFString.
sl@0
   486
 *
sl@0
   487
 *	Leaves on failure.
sl@0
   488
 *
sl@0
   489
 *	@param	"TDesC& aDTMFString"
sl@0
   490
 *			DTMF sequence in a descriptor.
sl@0
   491
 *
sl@0
   492
 */
sl@0
   493
void CMMFDevSoundClientImp::PlayDTMFStringL(const TDesC& aDTMFString)
sl@0
   494
	{
sl@0
   495
	if (!iDevSoundObserver)
sl@0
   496
		User::Leave(KErrNotReady);
sl@0
   497
sl@0
   498
	iDevSoundProxy->PlayDTMFStringL(aDTMFString);
sl@0
   499
	}
sl@0
   500
sl@0
   501
/*
sl@0
   502
 *
sl@0
   503
 *	Initializes audio device and start playing tone sequence.
sl@0
   504
 *
sl@0
   505
 *	Leaves on failure.
sl@0
   506
 *
sl@0
   507
 *	@param	"TDesC8& aData"
sl@0
   508
 *			Tone sequence in a descriptor.
sl@0
   509
 *
sl@0
   510
 */
sl@0
   511
void CMMFDevSoundClientImp::PlayToneSequenceL(const TDesC8& aData)
sl@0
   512
	{
sl@0
   513
	if (!iDevSoundObserver)
sl@0
   514
		User::Leave(KErrNotReady);
sl@0
   515
sl@0
   516
	iDevSoundProxy->PlayToneSequenceL(aData);
sl@0
   517
	}
sl@0
   518
sl@0
   519
/*
sl@0
   520
 *
sl@0
   521
 *	Initializes audio device and start playing the specified pre-defined tone
sl@0
   522
 *	sequence.
sl@0
   523
 *
sl@0
   524
 *	Leaves on failure.
sl@0
   525
 *
sl@0
   526
 *	@param	"TInt aSequenceNumber"
sl@0
   527
 *			The index identifying the specific pre-defined tone sequence. Index
sl@0
   528
 *			values are relative to zero.
sl@0
   529
 *			This can be any value from zero to the value returned by a call to
sl@0
   530
 *			CMdaAudioPlayerUtility::FixedSequenceCount() - 1.
sl@0
   531
 *			The function raises a panic if sequence number is not within this
sl@0
   532
 *			range.
sl@0
   533
 *
sl@0
   534
 */
sl@0
   535
void CMMFDevSoundClientImp::PlayFixedSequenceL(TInt aSequenceNumber)
sl@0
   536
	{
sl@0
   537
	if (!iDevSoundObserver)
sl@0
   538
		User::Leave(KErrNotReady);
sl@0
   539
sl@0
   540
	iDevSoundProxy->PlayFixedSequenceL(aSequenceNumber);
sl@0
   541
	}
sl@0
   542
sl@0
   543
/*
sl@0
   544
 *
sl@0
   545
 *	Defines the duration of tone on, tone off and tone pause to be used during the
sl@0
   546
 *	DTMF tone playback operation.
sl@0
   547
 *
sl@0
   548
 *	Supported only during tone playing.
sl@0
   549
 *
sl@0
   550
 *	@param	"TTimeIntervalMicroSeconds32& aToneOnLength"
sl@0
   551
 *			The period over which the tone will be played. If this is set to
sl@0
   552
 *			zero, then the tone is not played.
sl@0
   553
 *
sl@0
   554
 *	@param	"TTimeIntervalMicroSeconds32& aToneOffLength"
sl@0
   555
 *			The period over which the no tone will be played.
sl@0
   556
 *
sl@0
   557
 *	@param	"TTimeIntervalMicroSeconds32& aPauseLength"
sl@0
   558
 *			The period over which the tone playing will be paused.
sl@0
   559
 *
sl@0
   560
 */
sl@0
   561
void CMMFDevSoundClientImp::SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength,
sl@0
   562
								TTimeIntervalMicroSeconds32& aToneOffLength,
sl@0
   563
								TTimeIntervalMicroSeconds32& aPauseLength) 
sl@0
   564
	{
sl@0
   565
	iDevSoundProxy->SetDTMFLengths(aToneOnLength, aToneOffLength, aPauseLength);
sl@0
   566
	}
sl@0
   567
sl@0
   568
/*
sl@0
   569
 *
sl@0
   570
 *	Defines the period over which the volume level is to rise smoothly from
sl@0
   571
 *	nothing to the normal volume level.
sl@0
   572
 *
sl@0
   573
 *	@param	"TTimeIntervalMicroSeconds& aRampDuration"
sl@0
   574
 *			The period over which the volume is to rise. A zero value causes 
sl@0
   575
 *			the tone sample to be played at the normal level for the full
sl@0
   576
 *			duration of the playback. A value, which is longer than the duration
sl@0
   577
 *			of the tone sample, that the sample never reaches its normal
sl@0
   578
 *			volume level.
sl@0
   579
 *
sl@0
   580
 *
sl@0
   581
 */
sl@0
   582
void CMMFDevSoundClientImp::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration)
sl@0
   583
	{
sl@0
   584
	iDevSoundProxy->SetVolumeRamp(aRampDuration);
sl@0
   585
	}
sl@0
   586
sl@0
   587
sl@0
   588
/**
sl@0
   589
 *	@see sounddevice.h
sl@0
   590
 */
sl@0
   591
void CMMFDevSoundClientImp::GetSupportedInputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const
sl@0
   592
	{
sl@0
   593
	iDevSoundProxy->GetSupportedInputDataTypesL(aSupportedDataTypes, aPrioritySettings);
sl@0
   594
	}
sl@0
   595
sl@0
   596
/**
sl@0
   597
 *	@see sounddevice.h
sl@0
   598
 */
sl@0
   599
void CMMFDevSoundClientImp::GetSupportedOutputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const
sl@0
   600
	{
sl@0
   601
	iDevSoundProxy->GetSupportedOutputDataTypesL(aSupportedDataTypes, aPrioritySettings);
sl@0
   602
	}
sl@0
   603
sl@0
   604
/**
sl@0
   605
 *	@see sounddevice.h
sl@0
   606
 */
sl@0
   607
TInt CMMFDevSoundClientImp::SetClientThreadInfo(TThreadId aTid)
sl@0
   608
	{
sl@0
   609
	return iDevSoundProxy->SetClientThreadInfo(aTid);
sl@0
   610
	}
sl@0
   611
sl@0
   612
sl@0
   613
TInt CMMFDevSoundClientImp::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData)
sl@0
   614
	{
sl@0
   615
	return iDevSoundProxy->RegisterAsClient(aEventType,aNotificationRegistrationData);
sl@0
   616
	}
sl@0
   617
	
sl@0
   618
TInt CMMFDevSoundClientImp::CancelRegisterAsClient(TUid aEventType)
sl@0
   619
	{
sl@0
   620
	return iDevSoundProxy->CancelRegisterAsClient(aEventType);
sl@0
   621
	}
sl@0
   622
	
sl@0
   623
TInt CMMFDevSoundClientImp::GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData)
sl@0
   624
	{
sl@0
   625
	return iDevSoundProxy->GetResourceNotificationData(aEventType,aNotificationData);
sl@0
   626
	}
sl@0
   627
	
sl@0
   628
TInt CMMFDevSoundClientImp::WillResumePlay()
sl@0
   629
	{
sl@0
   630
	return iDevSoundProxy->WillResumePlay();
sl@0
   631
	}