os/mm/devsound/a3fdevsound/src/mmfdevsound/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.
     1 /*
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:
    15 *
    16 */
    17 
    18 
    19 
    20 #ifndef SOUNDDEVICEBODY_INL
    21 #define SOUNDDEVICEBODY_INL
    22 
    23 /*
    24 *
    25 *  Returns the supported Audio settings.
    26 *
    27 *  @return "TMMFCapabilities"
    28 *          Device settings.
    29 */
    30 inline TMMFCapabilities CMMFDevSound::CBody::Capabilities()
    31 	{
    32 	return iDevSoundProxy->Capabilities();
    33 	}
    34 
    35 /*
    36 *  Returns the current audio settings.
    37 *
    38 *  @return "TMMFCapabilities"
    39 *          Device settings.
    40 */
    41 inline TMMFCapabilities CMMFDevSound::CBody::Config() const
    42 	{
    43 	return iDevSoundProxy->Config();
    44 	}
    45 
    46 /*
    47 *  Configure CMMFDevSound::CBody object for the settings in aConfig.
    48 *
    49 *  Use this to set sampling rate, Encoding and Mono/Stereo.
    50 *
    51 *  @param  "aConfig"
    52 *          Attribute values to which CMMFDevSound::CBody object will be
    53 *          configured to.
    54 */
    55 inline void CMMFDevSound::CBody::SetConfigL(const TMMFCapabilities& aConfig)
    56 	{
    57 	iDevSoundProxy->SetConfigL(aConfig);
    58 	}
    59 
    60 /*
    61 *  Returns an integer representing the maximum volume.
    62 *
    63 *  This is the maximum value which can be passed to
    64 *  CMMFDevSound::CBody::SetVolume.
    65 *
    66 *  @return "TInt"
    67 *          The maximum volume. This value is platform dependent but is always
    68 *          greater than or equal to one.
    69 *
    70 */
    71 inline TInt CMMFDevSound::CBody::MaxVolume()
    72 	{
    73 	return iDevSoundProxy->MaxVolume();
    74 	}
    75 
    76 /*
    77 *  Returns an integer representing the current volume.
    78 *
    79 *  @return "TInt"
    80 *          The current volume level.
    81 */
    82 inline TInt CMMFDevSound::CBody::Volume()
    83 	{
    84 	return iDevSoundProxy->Volume();
    85 	}
    86 
    87 /*
    88 *  Changes the current playback volume to a specified value.
    89 *
    90 *  The volume can be changed before or during playback and is effective
    91 *  immediately.
    92 *
    93 *  @param  "aVolume"
    94 *          The volume setting. This can be any value from zero to the value
    95 *          returned by a call to CMMFDevSound::CBody::MaxVolume(). If the
    96 *          volume is not within this range, the volume is automatically set to
    97 *          minimum or maximum value based on the value that is being passed.
    98 *          Setting a zero value mutes the sound. Setting the maximum value
    99 *          results in the loudest possible sound.
   100 */
   101 inline void CMMFDevSound::CBody::SetVolume(TInt aVolume)
   102 	{
   103 	iDevSoundProxy->SetVolume(aVolume);
   104 	}
   105 
   106 /*
   107 *  Returns an integer representing the maximum gain.
   108 *
   109 *  This is the maximum value which can be passed to
   110 *  CMMFDevSound::CBody::SetGain.
   111 *
   112 *  @return "TInt"
   113 *          The maximum gain. This value is platform dependent but is always
   114 *          greater than or equal to one.
   115 *
   116 */
   117 inline TInt CMMFDevSound::CBody::MaxGain()
   118 	{
   119 	return iDevSoundProxy->MaxGain();
   120 	}
   121 
   122 /*
   123 *  Returns an integer representing the current gain.
   124 *
   125 *  @return "TInt"
   126 *          The current gain level.
   127 */
   128 inline TInt CMMFDevSound::CBody::Gain()
   129 	{
   130 	return iDevSoundProxy->Gain();
   131 	}
   132 
   133 /*
   134 *  Changes the current recording gain to a specified value.
   135 *
   136 *  The gain can be changed before or during recording and is effective
   137 *  immediately.
   138 *
   139 *  @param  "TInt aGain"
   140 *          The gain setting. This can be any value from zero to the value
   141 *          returned by a call to CMMFDevSound::CBody::MaxGain(). If the
   142 *          volume is not within this range, the gain is automatically set to
   143 *          minimum or maximum value based on the value that is being passed.
   144 *          Setting a zero value mutes the sound. Setting the maximum value
   145 *          results in the loudest possible sound.
   146 */
   147 inline void CMMFDevSound::CBody::SetGain(TInt aGain)
   148 	{
   149 	iDevSoundProxy->SetGain(aGain);
   150 	}
   151 
   152 /*
   153 *  Returns the speaker balance set for playing.
   154 *
   155 *  Leaves on failure.
   156 *
   157 *  @param  "aLeftPrecentage"
   158 *          On return contains the left speaker volume percentage.
   159 *
   160 *  @param  "aRightPercentage"
   161 *          On return contains the right speaker volume percentage.
   162 */
   163 inline void CMMFDevSound::CBody::GetPlayBalanceL(TInt& aLeftPercentage,
   164 						TInt& aRightPercentage)
   165 	{
   166 	iDevSoundProxy->GetPlayBalanceL(aLeftPercentage, aRightPercentage);
   167 	}
   168 
   169 /*
   170 *  Sets the speaker balance for playing.
   171 *
   172 *  The speaker balance can be changed before or during playback and is
   173 *  effective immediately.
   174 *
   175 *  @param  "aLeftPercentage"
   176 *          On return contains left speaker volume perecentage. This can be any
   177 *          value from zero to 100. Setting a zero value mutes the sound on left
   178 *          speaker.
   179 *
   180 *  @param  "aRightPercentage"
   181 *          On return contains right speaker volume perecentage. This can be any
   182 *          value from zero to 100. Setting a zero value mutes the sound on
   183 *          right speaker.
   184 */
   185 inline void CMMFDevSound::CBody::SetPlayBalanceL(TInt aLeftPercentage,
   186 						TInt aRightPercentage)
   187 	{
   188 	iDevSoundProxy->SetPlayBalanceL(aLeftPercentage, aRightPercentage);
   189 	}
   190 
   191 /*
   192 *  Returns the microphone gain balance set for recording.
   193 *
   194 *  Leaves on failure.
   195 *
   196 *  @param  "aLeftPercentage"
   197 *          On return contains the left microphone gain percentage.
   198 *
   199 *  @param  "aRightPercentage"
   200 *          On return contains the right microphone gain percentage.
   201 */
   202 inline void CMMFDevSound::CBody::GetRecordBalanceL(
   203 				TInt& aLeftPercentage,
   204 				TInt& aRightPercentage)
   205 	{
   206 	iDevSoundProxy->GetRecordBalanceL(aLeftPercentage, aRightPercentage);
   207 	}
   208 
   209 /*
   210 *  Sets the microphone gain balance for recording.
   211 *
   212 *  The microphone gain balance can be changed before or during recording and
   213 *  is effective immediately.
   214 *
   215 *  @param  "aLeftPercentage"
   216 *          Left microphone gain precentage. This can be any value from zero to
   217 *          100. Setting a zero value mutes the gain on left microphone.
   218 *
   219 *  @param  "aRightPercentage"
   220 *          Right microphone gain precentage. This can be any value from zero to
   221 *          100. Setting a zero value mutes the gain on right microphone.
   222 */
   223 inline void CMMFDevSound::CBody::SetRecordBalanceL(TInt aLeftPercentage,
   224 						TInt aRightPercentage)
   225 	{
   226 	iDevSoundProxy->SetRecordBalanceL(aLeftPercentage, aRightPercentage);
   227 	}
   228 
   229 /*
   230 *  Initializes audio device and start play process. This method queries and
   231 *  acquires the audio policy before initializing audio device. If there was an
   232 *  error during policy initialization, PlayError() method will be called on
   233 *  the observer with error code KErrAccessDenied, otherwise BufferToBeFilled()
   234 *  method will be called with a buffer reference. After reading data into the
   235 *  buffer reference passed, the client should call PlayData() to play data.
   236 *
   237 *  The amount of data that can be played is specified in
   238 *  CMMFBuffer::RequestSize(). Any data that is read into buffer beyond this
   239 *  size will be ignored.
   240 *
   241 *  Leaves on failure.
   242 */
   243 inline void CMMFDevSound::CBody::PlayInitL()
   244 	{
   245 	iDevSoundProxy->PlayInitL();
   246 	}
   247 
   248 /*
   249 *  Initializes audio device and start record process. This method queries and
   250 *  acquires the audio policy before initializing audio device. If there was an
   251 *  error during policy initialization, RecordError() method will be called on
   252 *  the observer with error code KErrAccessDenied, otherwise BufferToBeEmptied()
   253 *  method will be called with a buffer reference. This buffer contains recorded
   254 *  or encoded data. After processing data in the buffer reference passed, the
   255 *  client should call RecordData() to continue recording process.
   256 *
   257 *  The amount of data that is available is specified in
   258 *  CMMFBuffer::RequestSize().
   259 *
   260 *  Leaves on failure.
   261 */
   262 inline void CMMFDevSound::CBody::RecordInitL()
   263 	{
   264 	iDevSoundProxy->RecordInitL();
   265 	}
   266 
   267 /*
   268 *  Plays data in the buffer at the current volume. The client should fill
   269 *  the buffer with audio data before calling this method. The Observer gets
   270 *  reference to buffer along with callback BufferToBeFilled(). When playing of
   271 *  the audio sample is complete, successfully or otherwise, the method
   272 *  PlayError() on observer is called.
   273 */
   274 inline void CMMFDevSound::CBody::PlayData()
   275 	{
   276 	iDevSoundProxy->PlayData();
   277 	}
   278 
   279 /*
   280 *  Contine the process of recording. Once the buffer is filled with recorded
   281 *  data, the Observer gets reference to buffer along with callback
   282 *  BufferToBeEmptied(). After processing the buffer (copying over to a
   283 *  different buffer or writing to file) the client should call this
   284 *  method to continue recording process.
   285 */
   286 inline void CMMFDevSound::CBody::RecordData()
   287 	{
   288 	iDevSoundProxy->RecordData();
   289 	}
   290 
   291 /*
   292 *  Stops the ongoing operation (Play, Record, TonePlay)
   293 */
   294 inline void CMMFDevSound::CBody::Stop()
   295 	{
   296 	iDevSoundProxy->Stop();
   297 	}
   298 
   299 /*
   300 *  Temporarily Stops the ongoing operation (Play, Record, TonePlay)
   301 */
   302 inline void CMMFDevSound::CBody::Pause()
   303 	{
   304 	iDevSoundProxy->Pause();
   305 	}
   306 
   307 /*
   308 *  Returns the sample recorded so far.
   309 *
   310 *  @return "TInt"
   311 *          Returns the samples recorded.
   312 */
   313 inline TInt CMMFDevSound::CBody::SamplesRecorded()
   314 	{
   315 	return iDevSoundProxy->SamplesRecorded();
   316 	}
   317 
   318 /*
   319 *  Returns the sample played so far.
   320 *
   321 *  @return "TInt"
   322 *          Returns the samples recorded.
   323 */
   324 inline TInt CMMFDevSound::CBody::SamplesPlayed()
   325 	{
   326 	return iDevSoundProxy->SamplesPlayed();
   327 	}
   328 
   329 
   330 /*
   331 *  Initializes audio device and start playing tone. Tone is played with
   332 *  frequency and for duration specified.
   333 *
   334 *  Leaves on failure.
   335 *
   336 *  @param  "aFrequency"
   337 *          Frequency at with the tone will be played.
   338 *
   339 *  @param  "aDuration"
   340 *          The period over which the tone will be played. A zero value causes
   341 *          the no tone to be played (Verify this with test app).
   342 */
   343 inline void CMMFDevSound::CBody::PlayToneL(
   344 				TInt aFrequency,
   345 				const TTimeIntervalMicroSeconds& aDuration)
   346 	{
   347 	iDevSoundProxy->PlayToneL(aFrequency, aDuration);
   348 	}
   349 
   350 /*
   351 *  Initializes audio device and start playing a dual tone.
   352 *  The tone consists of two sine waves of different frequencies summed together
   353 *  Dual Tone is played with specified frequencies and for specified duration.
   354 *
   355 *  @param  "aFrequencyOne"
   356 *          First frequency of dual tone
   357 *
   358 *  @param  "aFrequencyTwo"
   359 *          Second frequency of dual tone
   360 *
   361 *  @param  "aDuration"
   362 *          The period over which the tone will be played. A zero value causes
   363 *          the no tone to be played (Verify this with test app).
   364 */
   365 inline void CMMFDevSound::CBody::PlayDualToneL(
   366 				TInt aFrequencyOne,
   367 				TInt aFrequencyTwo,
   368 				const TTimeIntervalMicroSeconds& aDuration)
   369 	{
   370 	iDevSoundProxy->PlayDualToneL(aFrequencyOne, aFrequencyTwo, aDuration);
   371 	}
   372 
   373 /*
   374 *  Initializes audio device and start playing DTMF string aDTMFString.
   375 *
   376 *  Leaves on failure.
   377 *
   378 *  @param  "aDTMFString"
   379 *          DTMF sequence in a descriptor.
   380 */
   381 inline void CMMFDevSound::CBody::PlayDTMFStringL(const TDesC& aDTMFString)
   382 	{
   383 	iDevSoundProxy->PlayDTMFStringL(aDTMFString);
   384 	}
   385 
   386 /*
   387 *  Initializes audio device and start playing tone sequence.
   388 *
   389 *  Leaves on failure.
   390 *
   391 *  @param  "TDesC8& aData"
   392 *          Tone sequence in a descriptor.
   393 */
   394 inline void CMMFDevSound::CBody::PlayToneSequenceL(const TDesC8& aData)
   395 	{
   396 	iDevSoundProxy->PlayToneSequenceL(aData);
   397 	}
   398 
   399 /*
   400 *  Defines the number of times the audio is to be repeated during the tone
   401 *  playback operation.
   402 *
   403 *  A period of silence can follow each playing of tone. The tone playing can
   404 *  be repeated indefinitely.
   405 *
   406 *  @param  " aRepeatCount"
   407 *          The number of times the tone, together with the trailing silence,
   408 *          is to be repeated. If this is set to KMdaRepeatForever, then the
   409 *          tone, together with the trailing silence, is repeated indefinitely
   410 *          or until Stop() is called. If this is set to zero, then the tone is
   411 *          not repeated.
   412 *
   413 *          Supported only during tone playing.
   414 */
   415 inline void CMMFDevSound::CBody::SetToneRepeats(
   416 			TInt aRepeatCount,
   417 			const TTimeIntervalMicroSeconds& aRepeatTrailingSilence)
   418 	{
   419 	iDevSoundProxy->SetToneRepeats(aRepeatCount, aRepeatTrailingSilence);
   420 	}
   421 
   422 /*
   423 *  Defines the duration of tone on, tone off and tone pause to be used during
   424 *  the DTMF tone playback operation.
   425 *
   426 *  Supported only during tone playing.
   427 *
   428 *  @param  "aToneOnLength"
   429 *          The period over which the tone will be played. If this is set to
   430 *          zero, then the tone is not played.
   431 *
   432 *  @param  "aToneOffLength"
   433 *          The period over which the no tone will be played.
   434 *
   435 *  @param  "aPauseLength"
   436 *          The period over which the tone playing will be paused.
   437 */
   438 inline void CMMFDevSound::CBody::SetDTMFLengths(
   439 			TTimeIntervalMicroSeconds32& aToneOnLength,
   440 			TTimeIntervalMicroSeconds32& aToneOffLength,
   441 			TTimeIntervalMicroSeconds32& aPauseLength)
   442 	{
   443 	iDevSoundProxy->SetDTMFLengths(aToneOnLength,
   444 					aToneOffLength,
   445 					aPauseLength);
   446 	}
   447 
   448 /*
   449 *  Defines the period over which the volume level is to rise smoothly from
   450 *  nothing to the normal volume level.
   451 *
   452 *  @param  "aRampDuration"
   453 *          The period over which the volume is to rise. A zero value causes
   454 *          the tone sample to be played at the normal level for the full
   455 *          duration of the playback. A value, which is longer than the duration
   456 *          of the tone sample, that the sample never reaches its normal
   457 *          volume level.
   458 */
   459 inline void CMMFDevSound::CBody::SetVolumeRamp(
   460 					const TTimeIntervalMicroSeconds& aRampDuration)
   461 	{
   462 	iDevSoundProxy->SetVolumeRamp(aRampDuration);
   463 	}
   464 
   465 /*
   466 *  Defines the priority settings that should be used for this instance.
   467 *
   468 *  @param  "aPrioritySettings"
   469 *          An class type representing the client's priority, priority
   470 *          preference and state.
   471 */
   472 inline void CMMFDevSound::CBody::SetPrioritySettings(
   473 					const TMMFPrioritySettings& aPrioritySettings)
   474 	{
   475 	iDevSoundProxy->SetPrioritySettings(aPrioritySettings);
   476 	}
   477 
   478 
   479 /*
   480 *  Returns a list of supported input data types that can be sent to the
   481 *  DevSound for playing audio.
   482 */
   483 inline void CMMFDevSound::CBody::GetSupportedInputDataTypesL(
   484 					RArray<TFourCC>& aSupportedDataTypes,
   485 					const TMMFPrioritySettings& aPrioritySettings) const
   486 	{
   487 	iDevSoundProxy->GetSupportedInputDataTypesL(aSupportedDataTypes,
   488 						aPrioritySettings);
   489 	}
   490 
   491 
   492 /*
   493 *  Returns a list of supported output data types that can be received from
   494 *  the DevSound for recording audio.
   495 */
   496 inline void CMMFDevSound::CBody::GetSupportedOutputDataTypesL(
   497 				RArray<TFourCC>& aSupportedDataTypes,
   498 				const TMMFPrioritySettings& aPrioritySettings) const
   499 	{
   500 	iDevSoundProxy->GetSupportedOutputDataTypesL(aSupportedDataTypes,
   501 							aPrioritySettings);
   502 	}
   503 	
   504 /* Registers the client for notification
   505 */
   506 inline TInt CMMFDevSound::CBody::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData)
   507 	{
   508 	return iDevSoundProxy->RegisterAsClient(aEventType,aNotificationRegistrationData);
   509 	}
   510 /* Cancels the registered notification
   511 */
   512 inline TInt CMMFDevSound::CBody::CancelRegisterAsClient(TUid aEventType)
   513 	{
   514 	return iDevSoundProxy->CancelRegisterAsClient(aEventType);
   515 	}
   516 
   517 /* Get the notification data to resume 
   518 */
   519 inline TInt CMMFDevSound::CBody::GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData)
   520 	{
   521 	return iDevSoundProxy->GetResourceNotificationData(aEventType,aNotificationData);
   522 	}
   523 
   524 /*if client need more than the default timeout period
   525 */
   526 inline TInt CMMFDevSound::CBody::WillResumePlay()
   527 	{
   528 	return iDevSoundProxy->WillResumePlay();
   529 	}
   530 
   531 /*
   532  * Empties the buffers below DevSound without 
   533  * causing the codec to be deleted.
   534 */
   535 inline TInt CMMFDevSound::CBody::EmptyBuffers()
   536 	{
   537 	return iDevSoundProxy->EmptyBuffers();
   538 	}
   539 
   540 /*
   541  * Cancels the initialization process
   542 */
   543 inline TInt CMMFDevSound::CBody::CancelInitialize()
   544 	{
   545 	return iDevSoundProxy->CancelInitialize();
   546 	}
   547 
   548 /*
   549 *  Queries about if Resume operation is supported
   550 */
   551 inline TBool CMMFDevSound::CBody::IsResumeSupported()
   552 	{
   553 	return iDevSoundProxy->IsResumeSupported();
   554 	}
   555 
   556 /*
   557 * Resume the temporarily stoppped ongoing operation (Play, Record, TonePlay)
   558 */
   559 inline TInt CMMFDevSound::CBody::Resume()
   560 	{
   561 	return iDevSoundProxy->Resume();
   562 	}
   563 
   564 inline TInt CMMFDevSound::CBody::SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
   565 	{
   566 	return iDevSoundProxy->SyncCustomCommand(aUid, aParam1, aParam2, aOutParam);
   567 	}
   568 
   569 inline void CMMFDevSound::CBody::AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
   570 	{
   571 	iDevSoundProxy->AsyncCustomCommand(aUid, aStatus, aParam1, aParam2, aOutParam);
   572 	}
   573 	
   574 #endif // SOUNDDEVICEBODY_INL
   575 
   576 // End of File