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