os/mm/devsound/devsoundrefplugin/src/platsec/SoundDevice/SoundDeviceBody.inl
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
// 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
// Initializes DevSound object for the mode aMode for processing audio data
sl@0
    15
// with hardware device aHWDev.
sl@0
    16
// On completion of Initialization, the observer will be notified via call back
sl@0
    17
// InitializeComplete().
sl@0
    18
// Leaves on failure.
sl@0
    19
// @param	"MDevSoundObserver& aDevSoundObserver"
sl@0
    20
// A reference to DevSound Observer instance.
sl@0
    21
// @param	"TUid aHWDev"
sl@0
    22
// CMMFHwDevice implementation identifier.
sl@0
    23
// @param	"TMMFState aMode"
sl@0
    24
// Mode for which this object will be used.
sl@0
    25
// 
sl@0
    26
//
sl@0
    27
sl@0
    28
inline void CMMFDevSoundClientImp::InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode)
sl@0
    29
	{
sl@0
    30
	TInt initError = KErrNone;
sl@0
    31
	iDevSoundObserver = &aDevSoundObserver;
sl@0
    32
	initError = iDevSoundProxy->InitializeL(aHWDev, aMode);
sl@0
    33
sl@0
    34
	if (initError)
sl@0
    35
		{
sl@0
    36
		User::Leave(initError);
sl@0
    37
		}
sl@0
    38
sl@0
    39
	if (iMsgQueueHandler)
sl@0
    40
		{
sl@0
    41
		iMsgQueueHandler->Cancel();
sl@0
    42
		iMsgQueueHandler->SetObserver(*iDevSoundObserver);
sl@0
    43
		}
sl@0
    44
	else
sl@0
    45
		{
sl@0
    46
		iMsgQueueHandler = CMsgQueueHandler::NewL(iDevSoundProxy, *iDevSoundObserver, &iMsgQueue, *this);
sl@0
    47
		}
sl@0
    48
sl@0
    49
	iMsgQueueHandler->ReceiveEvents();
sl@0
    50
	}
sl@0
    51
sl@0
    52
/*
sl@0
    53
 *
sl@0
    54
 *	Initializes DevSound object for the mode aMode for processing audio data
sl@0
    55
 *	with hardware device supporting FourCC aDesiredFourCC.
sl@0
    56
 *
sl@0
    57
 *	On completion of Initialization, the observer will be notified via call back
sl@0
    58
 *	InitializeComplete().
sl@0
    59
 *
sl@0
    60
 *	Leaves on failure.
sl@0
    61
 *  
sl@0
    62
 *	@param	"MDevSoundObserver& aDevSoundObserver"
sl@0
    63
 *			A reference to DevSound Observer instance.
sl@0
    64
 *
sl@0
    65
 *	@param	"TFourCC aDesiredFourCC"
sl@0
    66
 *			CMMFHwDevice implementation FourCC.
sl@0
    67
 *
sl@0
    68
 *	@param	"TMMFState aMode"
sl@0
    69
 *			Mode for which this object will be used.
sl@0
    70
 *
sl@0
    71
 */
sl@0
    72
inline void CMMFDevSoundClientImp::InitializeL(MDevSoundObserver& aDevSoundObserver, 
sl@0
    73
										  TFourCC aDesiredFourCC, TMMFState aMode)
sl@0
    74
	{
sl@0
    75
	TInt initError = KErrNone;
sl@0
    76
	iDevSoundObserver = &aDevSoundObserver;
sl@0
    77
sl@0
    78
	initError = iDevSoundProxy->InitializeL(aDesiredFourCC, aMode);
sl@0
    79
sl@0
    80
	if (initError)
sl@0
    81
		{
sl@0
    82
		User::Leave(initError);
sl@0
    83
		}
sl@0
    84
sl@0
    85
	if (iMsgQueueHandler)
sl@0
    86
		{
sl@0
    87
		iMsgQueueHandler->Cancel();
sl@0
    88
		iMsgQueueHandler->SetObserver(*iDevSoundObserver);
sl@0
    89
		}
sl@0
    90
	else
sl@0
    91
		{
sl@0
    92
		iMsgQueueHandler = CMsgQueueHandler::NewL(iDevSoundProxy, *iDevSoundObserver, &iMsgQueue, *this);
sl@0
    93
		}
sl@0
    94
	iMsgQueueHandler->ReceiveEvents();
sl@0
    95
	}
sl@0
    96
sl@0
    97
/*
sl@0
    98
 *
sl@0
    99
 *	Returns the supported Audio settings.
sl@0
   100
 *  
sl@0
   101
 *	@return	"TMMFCapabilities"
sl@0
   102
 *			Device settings.
sl@0
   103
 *
sl@0
   104
 */
sl@0
   105
inline TMMFCapabilities CMMFDevSoundClientImp::Capabilities()
sl@0
   106
	{
sl@0
   107
	return iDevSoundProxy->Capabilities();
sl@0
   108
	}
sl@0
   109
sl@0
   110
/*
sl@0
   111
 *
sl@0
   112
 *	Returns the current audio settings.
sl@0
   113
 *  
sl@0
   114
 *	@return	"TMMFCapabilities"
sl@0
   115
 *			Device settings.
sl@0
   116
 *
sl@0
   117
 */
sl@0
   118
inline TMMFCapabilities CMMFDevSoundClientImp::Config() const
sl@0
   119
	{
sl@0
   120
	return iDevSoundProxy->Config();
sl@0
   121
	}
sl@0
   122
sl@0
   123
/*
sl@0
   124
 *
sl@0
   125
 *	Returns an integer representing the maximum volume.
sl@0
   126
 *
sl@0
   127
 *	This is the maximum value which can be passed to CMMFDevSound::SetVolume.
sl@0
   128
 *  
sl@0
   129
 *	@return	"TInt"
sl@0
   130
 *			The maximum volume. This value is platform dependent but is always
sl@0
   131
 *			greater than or equal to one.
sl@0
   132
 *
sl@0
   133
 */
sl@0
   134
inline TInt CMMFDevSoundClientImp::MaxVolume()
sl@0
   135
	{
sl@0
   136
	return iDevSoundProxy->MaxVolume();
sl@0
   137
	}
sl@0
   138
sl@0
   139
/*
sl@0
   140
 *
sl@0
   141
 *	Returns an integer representing the current volume.
sl@0
   142
 * 
sl@0
   143
 *	@return	"TInt"
sl@0
   144
 *			The current volume level.
sl@0
   145
 *
sl@0
   146
 */
sl@0
   147
inline TInt CMMFDevSoundClientImp::Volume()
sl@0
   148
	{
sl@0
   149
	return iDevSoundProxy->Volume();
sl@0
   150
	}
sl@0
   151
sl@0
   152
/*
sl@0
   153
 *
sl@0
   154
 *	Returns an integer representing the maximum gain.
sl@0
   155
 *
sl@0
   156
 *	This is the maximum value which can be passed to CMMFDevSound::SetGain.
sl@0
   157
 * 
sl@0
   158
 *	@return	"TInt"
sl@0
   159
 *			The maximum gain. This value is platform dependent but is always
sl@0
   160
 *			greater than or equal to one.
sl@0
   161
 *
sl@0
   162
 */
sl@0
   163
inline TInt CMMFDevSoundClientImp::MaxGain()
sl@0
   164
	{
sl@0
   165
	return iDevSoundProxy->MaxGain();
sl@0
   166
	}
sl@0
   167
sl@0
   168
/*
sl@0
   169
 *
sl@0
   170
 *	Returns an integer representing the current gain.
sl@0
   171
 *
sl@0
   172
 *	@return	"TInt"
sl@0
   173
 *			The current gain level.
sl@0
   174
 *
sl@0
   175
 */
sl@0
   176
inline TInt CMMFDevSoundClientImp::Gain()
sl@0
   177
	{
sl@0
   178
	return iDevSoundProxy->Gain();
sl@0
   179
	}
sl@0
   180
sl@0
   181
/*
sl@0
   182
 *
sl@0
   183
 *	Returns the speaker balance set for playing.
sl@0
   184
 *
sl@0
   185
 *	Leaves on failure.
sl@0
   186
 *
sl@0
   187
 *	@param	"TInt& aLeftPercentage"
sl@0
   188
 *			On return contains the left speaker volume percentage.
sl@0
   189
 *
sl@0
   190
 *	@param	"TInt& aRightPercentage"
sl@0
   191
 *			On return contains the right speaker volume percentage.
sl@0
   192
 *
sl@0
   193
 */
sl@0
   194
inline void CMMFDevSoundClientImp::GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage)
sl@0
   195
	{
sl@0
   196
	iDevSoundProxy->GetPlayBalanceL(aLeftPercentage, aRightPercentage);
sl@0
   197
	}
sl@0
   198
sl@0
   199
/*
sl@0
   200
 *
sl@0
   201
 *	Returns the microphone gain balance set for recording.
sl@0
   202
 *
sl@0
   203
 *	Leaves on failure.
sl@0
   204
 *
sl@0
   205
 *	@param	"TInt& aLeftPercentage"
sl@0
   206
 *			On return contains the left microphone gain percentage.
sl@0
   207
 *
sl@0
   208
 *	@param	"TInt& aRightPercentage"
sl@0
   209
 *			On return contains the right microphone gain percentage.
sl@0
   210
 *
sl@0
   211
 */
sl@0
   212
inline void CMMFDevSoundClientImp::GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage)
sl@0
   213
	{
sl@0
   214
	iDevSoundProxy->GetRecordBalanceL(aLeftPercentage, aRightPercentage);
sl@0
   215
	}
sl@0
   216
sl@0
   217
/*
sl@0
   218
 *
sl@0
   219
 *	Contine the process of recording. Once the buffer is filled with recorded
sl@0
   220
 *	data, the Observer gets reference to buffer along with callback
sl@0
   221
 *	BufferToBeEmptied(). After processing the buffer (copying over to a
sl@0
   222
 *	different buffer or writing to file) the client should call this
sl@0
   223
 *	method to continue recording process.
sl@0
   224
 *
sl@0
   225
 */
sl@0
   226
inline void CMMFDevSoundClientImp::RecordData()
sl@0
   227
	{
sl@0
   228
	ASSERT(iDevSoundObserver);
sl@0
   229
	iDevSoundProxy->RecordData();
sl@0
   230
	}
sl@0
   231
sl@0
   232
/*
sl@0
   233
 *
sl@0
   234
 *	Defines the number of times the audio is to be repeated during the tone
sl@0
   235
 *	playback operation.
sl@0
   236
 *
sl@0
   237
 *	A period of silence can follow each playing of tone. The tone playing can
sl@0
   238
 *	be repeated indefinitely.
sl@0
   239
 *
sl@0
   240
 *	@param	"TInt aRepeatCount"
sl@0
   241
 *			The number of times the tone, together with the trailing silence,
sl@0
   242
 *			is to be repeated. If this is set to KMdaRepeatForever, then the
sl@0
   243
 *			tone, together with the trailing silence, is repeated indefinitely
sl@0
   244
 *			or until Stop() is called. If this is set to zero, then the tone is
sl@0
   245
 *			not repeated.
sl@0
   246
 *
sl@0
   247
 *			Supported only during tone playing.
sl@0
   248
 *
sl@0
   249
 */
sl@0
   250
inline void CMMFDevSoundClientImp::SetToneRepeats(TInt aRepeatCount,
sl@0
   251
				const TTimeIntervalMicroSeconds& aRepeatTrailingSilence)
sl@0
   252
	{
sl@0
   253
	iDevSoundProxy->SetToneRepeats(aRepeatCount, aRepeatTrailingSilence);
sl@0
   254
	}
sl@0
   255
sl@0
   256
/*
sl@0
   257
 *
sl@0
   258
 *	Defines the priority settings that should be used for this instance.
sl@0
   259
 *
sl@0
   260
 *	@param	"const TMMFPrioritySettings& aPrioritySettings"
sl@0
   261
 *			An class type representing the client's priority, priority 
sl@0
   262
 *			preference and state.
sl@0
   263
 *
sl@0
   264
 */
sl@0
   265
inline void CMMFDevSoundClientImp::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings)
sl@0
   266
	{
sl@0
   267
	iDevSoundProxy->SetPrioritySettings(aPrioritySettings);
sl@0
   268
	}
sl@0
   269
sl@0
   270
sl@0
   271
/*
sl@0
   272
 *
sl@0
   273
 *	Returns the number of available pre-defined tone sequences.
sl@0
   274
 *
sl@0
   275
 *	This is the number of fixed sequence supported by DevSound by default.
sl@0
   276
 *
sl@0
   277
 *	@return	"TInt"
sl@0
   278
 *			The fixed sequence count. This value is implementation dependent
sl@0
   279
 *			but is always greater than or equal to zero.
sl@0
   280
 *
sl@0
   281
 */
sl@0
   282
inline TInt CMMFDevSoundClientImp::FixedSequenceCount()
sl@0
   283
	{
sl@0
   284
sl@0
   285
	return iDevSoundProxy->FixedSequenceCount();
sl@0
   286
	}
sl@0
   287
sl@0
   288
/*
sl@0
   289
 *
sl@0
   290
 *	Returns the name assigned to a specific pre-defined tone sequence.
sl@0
   291
 *
sl@0
   292
 *	This is the number of fixed sequence supported by DevSound by default.
sl@0
   293
 *
sl@0
   294
 *	The function raises a panic if sequence number specified invalid.
sl@0
   295
 *
sl@0
   296
 *	@return	"TDesC&"
sl@0
   297
 *			A reference to a Descriptor containing the fixed sequence
sl@0
   298
 *			name indexed by aSequenceNumber.
sl@0
   299
 *
sl@0
   300
 *	@param	"TInt aSequenceNumber"
sl@0
   301
 *			The index identifying the specific pre-defined tone sequence. Index
sl@0
   302
 *			values are relative to zero.
sl@0
   303
 *			This can be any value from zero to the value returned by a call to
sl@0
   304
 *			CMdaAudioPlayerUtility::FixedSequenceCount() - 1.
sl@0
   305
 *			The function raises a panic if sequence number is not within this
sl@0
   306
 *			range.
sl@0
   307
 *
sl@0
   308
 */
sl@0
   309
inline const TDesC& CMMFDevSoundClientImp::FixedSequenceName(TInt aSequenceNumber)
sl@0
   310
	{
sl@0
   311
	return iDevSoundProxy->FixedSequenceName(aSequenceNumber);
sl@0
   312
	}
sl@0
   313
sl@0
   314
sl@0
   315
inline TInt CMMFDevSoundClientImp::SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
sl@0
   316
	{
sl@0
   317
	return iDevSoundProxy->SyncCustomCommand(aUid, aParam1, aParam2, aOutParam);
sl@0
   318
	}
sl@0
   319
sl@0
   320
inline void CMMFDevSoundClientImp::AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
sl@0
   321
	{
sl@0
   322
	iDevSoundProxy->AsyncCustomCommand(aUid, aStatus, aParam1, aParam2, aOutParam);
sl@0
   323
	}
sl@0
   324