os/mm/devsound/devsoundrefplugin/src/platsec/SoundDevice/SoundDeviceBody.inl
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/devsound/devsoundrefplugin/src/platsec/SoundDevice/SoundDeviceBody.inl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,324 @@
     1.4 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Initializes DevSound object for the mode aMode for processing audio data
    1.18 +// with hardware device aHWDev.
    1.19 +// On completion of Initialization, the observer will be notified via call back
    1.20 +// InitializeComplete().
    1.21 +// Leaves on failure.
    1.22 +// @param	"MDevSoundObserver& aDevSoundObserver"
    1.23 +// A reference to DevSound Observer instance.
    1.24 +// @param	"TUid aHWDev"
    1.25 +// CMMFHwDevice implementation identifier.
    1.26 +// @param	"TMMFState aMode"
    1.27 +// Mode for which this object will be used.
    1.28 +// 
    1.29 +//
    1.30 +
    1.31 +inline void CMMFDevSoundClientImp::InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode)
    1.32 +	{
    1.33 +	TInt initError = KErrNone;
    1.34 +	iDevSoundObserver = &aDevSoundObserver;
    1.35 +	initError = iDevSoundProxy->InitializeL(aHWDev, aMode);
    1.36 +
    1.37 +	if (initError)
    1.38 +		{
    1.39 +		User::Leave(initError);
    1.40 +		}
    1.41 +
    1.42 +	if (iMsgQueueHandler)
    1.43 +		{
    1.44 +		iMsgQueueHandler->Cancel();
    1.45 +		iMsgQueueHandler->SetObserver(*iDevSoundObserver);
    1.46 +		}
    1.47 +	else
    1.48 +		{
    1.49 +		iMsgQueueHandler = CMsgQueueHandler::NewL(iDevSoundProxy, *iDevSoundObserver, &iMsgQueue, *this);
    1.50 +		}
    1.51 +
    1.52 +	iMsgQueueHandler->ReceiveEvents();
    1.53 +	}
    1.54 +
    1.55 +/*
    1.56 + *
    1.57 + *	Initializes DevSound object for the mode aMode for processing audio data
    1.58 + *	with hardware device supporting FourCC aDesiredFourCC.
    1.59 + *
    1.60 + *	On completion of Initialization, the observer will be notified via call back
    1.61 + *	InitializeComplete().
    1.62 + *
    1.63 + *	Leaves on failure.
    1.64 + *  
    1.65 + *	@param	"MDevSoundObserver& aDevSoundObserver"
    1.66 + *			A reference to DevSound Observer instance.
    1.67 + *
    1.68 + *	@param	"TFourCC aDesiredFourCC"
    1.69 + *			CMMFHwDevice implementation FourCC.
    1.70 + *
    1.71 + *	@param	"TMMFState aMode"
    1.72 + *			Mode for which this object will be used.
    1.73 + *
    1.74 + */
    1.75 +inline void CMMFDevSoundClientImp::InitializeL(MDevSoundObserver& aDevSoundObserver, 
    1.76 +										  TFourCC aDesiredFourCC, TMMFState aMode)
    1.77 +	{
    1.78 +	TInt initError = KErrNone;
    1.79 +	iDevSoundObserver = &aDevSoundObserver;
    1.80 +
    1.81 +	initError = iDevSoundProxy->InitializeL(aDesiredFourCC, aMode);
    1.82 +
    1.83 +	if (initError)
    1.84 +		{
    1.85 +		User::Leave(initError);
    1.86 +		}
    1.87 +
    1.88 +	if (iMsgQueueHandler)
    1.89 +		{
    1.90 +		iMsgQueueHandler->Cancel();
    1.91 +		iMsgQueueHandler->SetObserver(*iDevSoundObserver);
    1.92 +		}
    1.93 +	else
    1.94 +		{
    1.95 +		iMsgQueueHandler = CMsgQueueHandler::NewL(iDevSoundProxy, *iDevSoundObserver, &iMsgQueue, *this);
    1.96 +		}
    1.97 +	iMsgQueueHandler->ReceiveEvents();
    1.98 +	}
    1.99 +
   1.100 +/*
   1.101 + *
   1.102 + *	Returns the supported Audio settings.
   1.103 + *  
   1.104 + *	@return	"TMMFCapabilities"
   1.105 + *			Device settings.
   1.106 + *
   1.107 + */
   1.108 +inline TMMFCapabilities CMMFDevSoundClientImp::Capabilities()
   1.109 +	{
   1.110 +	return iDevSoundProxy->Capabilities();
   1.111 +	}
   1.112 +
   1.113 +/*
   1.114 + *
   1.115 + *	Returns the current audio settings.
   1.116 + *  
   1.117 + *	@return	"TMMFCapabilities"
   1.118 + *			Device settings.
   1.119 + *
   1.120 + */
   1.121 +inline TMMFCapabilities CMMFDevSoundClientImp::Config() const
   1.122 +	{
   1.123 +	return iDevSoundProxy->Config();
   1.124 +	}
   1.125 +
   1.126 +/*
   1.127 + *
   1.128 + *	Returns an integer representing the maximum volume.
   1.129 + *
   1.130 + *	This is the maximum value which can be passed to CMMFDevSound::SetVolume.
   1.131 + *  
   1.132 + *	@return	"TInt"
   1.133 + *			The maximum volume. This value is platform dependent but is always
   1.134 + *			greater than or equal to one.
   1.135 + *
   1.136 + */
   1.137 +inline TInt CMMFDevSoundClientImp::MaxVolume()
   1.138 +	{
   1.139 +	return iDevSoundProxy->MaxVolume();
   1.140 +	}
   1.141 +
   1.142 +/*
   1.143 + *
   1.144 + *	Returns an integer representing the current volume.
   1.145 + * 
   1.146 + *	@return	"TInt"
   1.147 + *			The current volume level.
   1.148 + *
   1.149 + */
   1.150 +inline TInt CMMFDevSoundClientImp::Volume()
   1.151 +	{
   1.152 +	return iDevSoundProxy->Volume();
   1.153 +	}
   1.154 +
   1.155 +/*
   1.156 + *
   1.157 + *	Returns an integer representing the maximum gain.
   1.158 + *
   1.159 + *	This is the maximum value which can be passed to CMMFDevSound::SetGain.
   1.160 + * 
   1.161 + *	@return	"TInt"
   1.162 + *			The maximum gain. This value is platform dependent but is always
   1.163 + *			greater than or equal to one.
   1.164 + *
   1.165 + */
   1.166 +inline TInt CMMFDevSoundClientImp::MaxGain()
   1.167 +	{
   1.168 +	return iDevSoundProxy->MaxGain();
   1.169 +	}
   1.170 +
   1.171 +/*
   1.172 + *
   1.173 + *	Returns an integer representing the current gain.
   1.174 + *
   1.175 + *	@return	"TInt"
   1.176 + *			The current gain level.
   1.177 + *
   1.178 + */
   1.179 +inline TInt CMMFDevSoundClientImp::Gain()
   1.180 +	{
   1.181 +	return iDevSoundProxy->Gain();
   1.182 +	}
   1.183 +
   1.184 +/*
   1.185 + *
   1.186 + *	Returns the speaker balance set for playing.
   1.187 + *
   1.188 + *	Leaves on failure.
   1.189 + *
   1.190 + *	@param	"TInt& aLeftPercentage"
   1.191 + *			On return contains the left speaker volume percentage.
   1.192 + *
   1.193 + *	@param	"TInt& aRightPercentage"
   1.194 + *			On return contains the right speaker volume percentage.
   1.195 + *
   1.196 + */
   1.197 +inline void CMMFDevSoundClientImp::GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage)
   1.198 +	{
   1.199 +	iDevSoundProxy->GetPlayBalanceL(aLeftPercentage, aRightPercentage);
   1.200 +	}
   1.201 +
   1.202 +/*
   1.203 + *
   1.204 + *	Returns the microphone gain balance set for recording.
   1.205 + *
   1.206 + *	Leaves on failure.
   1.207 + *
   1.208 + *	@param	"TInt& aLeftPercentage"
   1.209 + *			On return contains the left microphone gain percentage.
   1.210 + *
   1.211 + *	@param	"TInt& aRightPercentage"
   1.212 + *			On return contains the right microphone gain percentage.
   1.213 + *
   1.214 + */
   1.215 +inline void CMMFDevSoundClientImp::GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage)
   1.216 +	{
   1.217 +	iDevSoundProxy->GetRecordBalanceL(aLeftPercentage, aRightPercentage);
   1.218 +	}
   1.219 +
   1.220 +/*
   1.221 + *
   1.222 + *	Contine the process of recording. Once the buffer is filled with recorded
   1.223 + *	data, the Observer gets reference to buffer along with callback
   1.224 + *	BufferToBeEmptied(). After processing the buffer (copying over to a
   1.225 + *	different buffer or writing to file) the client should call this
   1.226 + *	method to continue recording process.
   1.227 + *
   1.228 + */
   1.229 +inline void CMMFDevSoundClientImp::RecordData()
   1.230 +	{
   1.231 +	ASSERT(iDevSoundObserver);
   1.232 +	iDevSoundProxy->RecordData();
   1.233 +	}
   1.234 +
   1.235 +/*
   1.236 + *
   1.237 + *	Defines the number of times the audio is to be repeated during the tone
   1.238 + *	playback operation.
   1.239 + *
   1.240 + *	A period of silence can follow each playing of tone. The tone playing can
   1.241 + *	be repeated indefinitely.
   1.242 + *
   1.243 + *	@param	"TInt aRepeatCount"
   1.244 + *			The number of times the tone, together with the trailing silence,
   1.245 + *			is to be repeated. If this is set to KMdaRepeatForever, then the
   1.246 + *			tone, together with the trailing silence, is repeated indefinitely
   1.247 + *			or until Stop() is called. If this is set to zero, then the tone is
   1.248 + *			not repeated.
   1.249 + *
   1.250 + *			Supported only during tone playing.
   1.251 + *
   1.252 + */
   1.253 +inline void CMMFDevSoundClientImp::SetToneRepeats(TInt aRepeatCount,
   1.254 +				const TTimeIntervalMicroSeconds& aRepeatTrailingSilence)
   1.255 +	{
   1.256 +	iDevSoundProxy->SetToneRepeats(aRepeatCount, aRepeatTrailingSilence);
   1.257 +	}
   1.258 +
   1.259 +/*
   1.260 + *
   1.261 + *	Defines the priority settings that should be used for this instance.
   1.262 + *
   1.263 + *	@param	"const TMMFPrioritySettings& aPrioritySettings"
   1.264 + *			An class type representing the client's priority, priority 
   1.265 + *			preference and state.
   1.266 + *
   1.267 + */
   1.268 +inline void CMMFDevSoundClientImp::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings)
   1.269 +	{
   1.270 +	iDevSoundProxy->SetPrioritySettings(aPrioritySettings);
   1.271 +	}
   1.272 +
   1.273 +
   1.274 +/*
   1.275 + *
   1.276 + *	Returns the number of available pre-defined tone sequences.
   1.277 + *
   1.278 + *	This is the number of fixed sequence supported by DevSound by default.
   1.279 + *
   1.280 + *	@return	"TInt"
   1.281 + *			The fixed sequence count. This value is implementation dependent
   1.282 + *			but is always greater than or equal to zero.
   1.283 + *
   1.284 + */
   1.285 +inline TInt CMMFDevSoundClientImp::FixedSequenceCount()
   1.286 +	{
   1.287 +
   1.288 +	return iDevSoundProxy->FixedSequenceCount();
   1.289 +	}
   1.290 +
   1.291 +/*
   1.292 + *
   1.293 + *	Returns the name assigned to a specific pre-defined tone sequence.
   1.294 + *
   1.295 + *	This is the number of fixed sequence supported by DevSound by default.
   1.296 + *
   1.297 + *	The function raises a panic if sequence number specified invalid.
   1.298 + *
   1.299 + *	@return	"TDesC&"
   1.300 + *			A reference to a Descriptor containing the fixed sequence
   1.301 + *			name indexed by aSequenceNumber.
   1.302 + *
   1.303 + *	@param	"TInt aSequenceNumber"
   1.304 + *			The index identifying the specific pre-defined tone sequence. Index
   1.305 + *			values are relative to zero.
   1.306 + *			This can be any value from zero to the value returned by a call to
   1.307 + *			CMdaAudioPlayerUtility::FixedSequenceCount() - 1.
   1.308 + *			The function raises a panic if sequence number is not within this
   1.309 + *			range.
   1.310 + *
   1.311 + */
   1.312 +inline const TDesC& CMMFDevSoundClientImp::FixedSequenceName(TInt aSequenceNumber)
   1.313 +	{
   1.314 +	return iDevSoundProxy->FixedSequenceName(aSequenceNumber);
   1.315 +	}
   1.316 +
   1.317 +
   1.318 +inline TInt CMMFDevSoundClientImp::SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
   1.319 +	{
   1.320 +	return iDevSoundProxy->SyncCustomCommand(aUid, aParam1, aParam2, aOutParam);
   1.321 +	}
   1.322 +
   1.323 +inline void CMMFDevSoundClientImp::AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
   1.324 +	{
   1.325 +	iDevSoundProxy->AsyncCustomCommand(aUid, aStatus, aParam1, aParam2, aOutParam);
   1.326 +	}
   1.327 +