1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsound/a3fdevsound/src/mmfdevsound/sounddevicebody.inl Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,576 @@
1.4 +/*
1.5 +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +#ifndef SOUNDDEVICEBODY_INL
1.24 +#define SOUNDDEVICEBODY_INL
1.25 +
1.26 +/*
1.27 +*
1.28 +* Returns the supported Audio settings.
1.29 +*
1.30 +* @return "TMMFCapabilities"
1.31 +* Device settings.
1.32 +*/
1.33 +inline TMMFCapabilities CMMFDevSound::CBody::Capabilities()
1.34 + {
1.35 + return iDevSoundProxy->Capabilities();
1.36 + }
1.37 +
1.38 +/*
1.39 +* Returns the current audio settings.
1.40 +*
1.41 +* @return "TMMFCapabilities"
1.42 +* Device settings.
1.43 +*/
1.44 +inline TMMFCapabilities CMMFDevSound::CBody::Config() const
1.45 + {
1.46 + return iDevSoundProxy->Config();
1.47 + }
1.48 +
1.49 +/*
1.50 +* Configure CMMFDevSound::CBody object for the settings in aConfig.
1.51 +*
1.52 +* Use this to set sampling rate, Encoding and Mono/Stereo.
1.53 +*
1.54 +* @param "aConfig"
1.55 +* Attribute values to which CMMFDevSound::CBody object will be
1.56 +* configured to.
1.57 +*/
1.58 +inline void CMMFDevSound::CBody::SetConfigL(const TMMFCapabilities& aConfig)
1.59 + {
1.60 + iDevSoundProxy->SetConfigL(aConfig);
1.61 + }
1.62 +
1.63 +/*
1.64 +* Returns an integer representing the maximum volume.
1.65 +*
1.66 +* This is the maximum value which can be passed to
1.67 +* CMMFDevSound::CBody::SetVolume.
1.68 +*
1.69 +* @return "TInt"
1.70 +* The maximum volume. This value is platform dependent but is always
1.71 +* greater than or equal to one.
1.72 +*
1.73 +*/
1.74 +inline TInt CMMFDevSound::CBody::MaxVolume()
1.75 + {
1.76 + return iDevSoundProxy->MaxVolume();
1.77 + }
1.78 +
1.79 +/*
1.80 +* Returns an integer representing the current volume.
1.81 +*
1.82 +* @return "TInt"
1.83 +* The current volume level.
1.84 +*/
1.85 +inline TInt CMMFDevSound::CBody::Volume()
1.86 + {
1.87 + return iDevSoundProxy->Volume();
1.88 + }
1.89 +
1.90 +/*
1.91 +* Changes the current playback volume to a specified value.
1.92 +*
1.93 +* The volume can be changed before or during playback and is effective
1.94 +* immediately.
1.95 +*
1.96 +* @param "aVolume"
1.97 +* The volume setting. This can be any value from zero to the value
1.98 +* returned by a call to CMMFDevSound::CBody::MaxVolume(). If the
1.99 +* volume is not within this range, the volume is automatically set to
1.100 +* minimum or maximum value based on the value that is being passed.
1.101 +* Setting a zero value mutes the sound. Setting the maximum value
1.102 +* results in the loudest possible sound.
1.103 +*/
1.104 +inline void CMMFDevSound::CBody::SetVolume(TInt aVolume)
1.105 + {
1.106 + iDevSoundProxy->SetVolume(aVolume);
1.107 + }
1.108 +
1.109 +/*
1.110 +* Returns an integer representing the maximum gain.
1.111 +*
1.112 +* This is the maximum value which can be passed to
1.113 +* CMMFDevSound::CBody::SetGain.
1.114 +*
1.115 +* @return "TInt"
1.116 +* The maximum gain. This value is platform dependent but is always
1.117 +* greater than or equal to one.
1.118 +*
1.119 +*/
1.120 +inline TInt CMMFDevSound::CBody::MaxGain()
1.121 + {
1.122 + return iDevSoundProxy->MaxGain();
1.123 + }
1.124 +
1.125 +/*
1.126 +* Returns an integer representing the current gain.
1.127 +*
1.128 +* @return "TInt"
1.129 +* The current gain level.
1.130 +*/
1.131 +inline TInt CMMFDevSound::CBody::Gain()
1.132 + {
1.133 + return iDevSoundProxy->Gain();
1.134 + }
1.135 +
1.136 +/*
1.137 +* Changes the current recording gain to a specified value.
1.138 +*
1.139 +* The gain can be changed before or during recording and is effective
1.140 +* immediately.
1.141 +*
1.142 +* @param "TInt aGain"
1.143 +* The gain setting. This can be any value from zero to the value
1.144 +* returned by a call to CMMFDevSound::CBody::MaxGain(). If the
1.145 +* volume is not within this range, the gain is automatically set to
1.146 +* minimum or maximum value based on the value that is being passed.
1.147 +* Setting a zero value mutes the sound. Setting the maximum value
1.148 +* results in the loudest possible sound.
1.149 +*/
1.150 +inline void CMMFDevSound::CBody::SetGain(TInt aGain)
1.151 + {
1.152 + iDevSoundProxy->SetGain(aGain);
1.153 + }
1.154 +
1.155 +/*
1.156 +* Returns the speaker balance set for playing.
1.157 +*
1.158 +* Leaves on failure.
1.159 +*
1.160 +* @param "aLeftPrecentage"
1.161 +* On return contains the left speaker volume percentage.
1.162 +*
1.163 +* @param "aRightPercentage"
1.164 +* On return contains the right speaker volume percentage.
1.165 +*/
1.166 +inline void CMMFDevSound::CBody::GetPlayBalanceL(TInt& aLeftPercentage,
1.167 + TInt& aRightPercentage)
1.168 + {
1.169 + iDevSoundProxy->GetPlayBalanceL(aLeftPercentage, aRightPercentage);
1.170 + }
1.171 +
1.172 +/*
1.173 +* Sets the speaker balance for playing.
1.174 +*
1.175 +* The speaker balance can be changed before or during playback and is
1.176 +* effective immediately.
1.177 +*
1.178 +* @param "aLeftPercentage"
1.179 +* On return contains left speaker volume perecentage. This can be any
1.180 +* value from zero to 100. Setting a zero value mutes the sound on left
1.181 +* speaker.
1.182 +*
1.183 +* @param "aRightPercentage"
1.184 +* On return contains right speaker volume perecentage. This can be any
1.185 +* value from zero to 100. Setting a zero value mutes the sound on
1.186 +* right speaker.
1.187 +*/
1.188 +inline void CMMFDevSound::CBody::SetPlayBalanceL(TInt aLeftPercentage,
1.189 + TInt aRightPercentage)
1.190 + {
1.191 + iDevSoundProxy->SetPlayBalanceL(aLeftPercentage, aRightPercentage);
1.192 + }
1.193 +
1.194 +/*
1.195 +* Returns the microphone gain balance set for recording.
1.196 +*
1.197 +* Leaves on failure.
1.198 +*
1.199 +* @param "aLeftPercentage"
1.200 +* On return contains the left microphone gain percentage.
1.201 +*
1.202 +* @param "aRightPercentage"
1.203 +* On return contains the right microphone gain percentage.
1.204 +*/
1.205 +inline void CMMFDevSound::CBody::GetRecordBalanceL(
1.206 + TInt& aLeftPercentage,
1.207 + TInt& aRightPercentage)
1.208 + {
1.209 + iDevSoundProxy->GetRecordBalanceL(aLeftPercentage, aRightPercentage);
1.210 + }
1.211 +
1.212 +/*
1.213 +* Sets the microphone gain balance for recording.
1.214 +*
1.215 +* The microphone gain balance can be changed before or during recording and
1.216 +* is effective immediately.
1.217 +*
1.218 +* @param "aLeftPercentage"
1.219 +* Left microphone gain precentage. This can be any value from zero to
1.220 +* 100. Setting a zero value mutes the gain on left microphone.
1.221 +*
1.222 +* @param "aRightPercentage"
1.223 +* Right microphone gain precentage. This can be any value from zero to
1.224 +* 100. Setting a zero value mutes the gain on right microphone.
1.225 +*/
1.226 +inline void CMMFDevSound::CBody::SetRecordBalanceL(TInt aLeftPercentage,
1.227 + TInt aRightPercentage)
1.228 + {
1.229 + iDevSoundProxy->SetRecordBalanceL(aLeftPercentage, aRightPercentage);
1.230 + }
1.231 +
1.232 +/*
1.233 +* Initializes audio device and start play process. This method queries and
1.234 +* acquires the audio policy before initializing audio device. If there was an
1.235 +* error during policy initialization, PlayError() method will be called on
1.236 +* the observer with error code KErrAccessDenied, otherwise BufferToBeFilled()
1.237 +* method will be called with a buffer reference. After reading data into the
1.238 +* buffer reference passed, the client should call PlayData() to play data.
1.239 +*
1.240 +* The amount of data that can be played is specified in
1.241 +* CMMFBuffer::RequestSize(). Any data that is read into buffer beyond this
1.242 +* size will be ignored.
1.243 +*
1.244 +* Leaves on failure.
1.245 +*/
1.246 +inline void CMMFDevSound::CBody::PlayInitL()
1.247 + {
1.248 + iDevSoundProxy->PlayInitL();
1.249 + }
1.250 +
1.251 +/*
1.252 +* Initializes audio device and start record process. This method queries and
1.253 +* acquires the audio policy before initializing audio device. If there was an
1.254 +* error during policy initialization, RecordError() method will be called on
1.255 +* the observer with error code KErrAccessDenied, otherwise BufferToBeEmptied()
1.256 +* method will be called with a buffer reference. This buffer contains recorded
1.257 +* or encoded data. After processing data in the buffer reference passed, the
1.258 +* client should call RecordData() to continue recording process.
1.259 +*
1.260 +* The amount of data that is available is specified in
1.261 +* CMMFBuffer::RequestSize().
1.262 +*
1.263 +* Leaves on failure.
1.264 +*/
1.265 +inline void CMMFDevSound::CBody::RecordInitL()
1.266 + {
1.267 + iDevSoundProxy->RecordInitL();
1.268 + }
1.269 +
1.270 +/*
1.271 +* Plays data in the buffer at the current volume. The client should fill
1.272 +* the buffer with audio data before calling this method. The Observer gets
1.273 +* reference to buffer along with callback BufferToBeFilled(). When playing of
1.274 +* the audio sample is complete, successfully or otherwise, the method
1.275 +* PlayError() on observer is called.
1.276 +*/
1.277 +inline void CMMFDevSound::CBody::PlayData()
1.278 + {
1.279 + iDevSoundProxy->PlayData();
1.280 + }
1.281 +
1.282 +/*
1.283 +* Contine the process of recording. Once the buffer is filled with recorded
1.284 +* data, the Observer gets reference to buffer along with callback
1.285 +* BufferToBeEmptied(). After processing the buffer (copying over to a
1.286 +* different buffer or writing to file) the client should call this
1.287 +* method to continue recording process.
1.288 +*/
1.289 +inline void CMMFDevSound::CBody::RecordData()
1.290 + {
1.291 + iDevSoundProxy->RecordData();
1.292 + }
1.293 +
1.294 +/*
1.295 +* Stops the ongoing operation (Play, Record, TonePlay)
1.296 +*/
1.297 +inline void CMMFDevSound::CBody::Stop()
1.298 + {
1.299 + iDevSoundProxy->Stop();
1.300 + }
1.301 +
1.302 +/*
1.303 +* Temporarily Stops the ongoing operation (Play, Record, TonePlay)
1.304 +*/
1.305 +inline void CMMFDevSound::CBody::Pause()
1.306 + {
1.307 + iDevSoundProxy->Pause();
1.308 + }
1.309 +
1.310 +/*
1.311 +* Returns the sample recorded so far.
1.312 +*
1.313 +* @return "TInt"
1.314 +* Returns the samples recorded.
1.315 +*/
1.316 +inline TInt CMMFDevSound::CBody::SamplesRecorded()
1.317 + {
1.318 + return iDevSoundProxy->SamplesRecorded();
1.319 + }
1.320 +
1.321 +/*
1.322 +* Returns the sample played so far.
1.323 +*
1.324 +* @return "TInt"
1.325 +* Returns the samples recorded.
1.326 +*/
1.327 +inline TInt CMMFDevSound::CBody::SamplesPlayed()
1.328 + {
1.329 + return iDevSoundProxy->SamplesPlayed();
1.330 + }
1.331 +
1.332 +
1.333 +/*
1.334 +* Initializes audio device and start playing tone. Tone is played with
1.335 +* frequency and for duration specified.
1.336 +*
1.337 +* Leaves on failure.
1.338 +*
1.339 +* @param "aFrequency"
1.340 +* Frequency at with the tone will be played.
1.341 +*
1.342 +* @param "aDuration"
1.343 +* The period over which the tone will be played. A zero value causes
1.344 +* the no tone to be played (Verify this with test app).
1.345 +*/
1.346 +inline void CMMFDevSound::CBody::PlayToneL(
1.347 + TInt aFrequency,
1.348 + const TTimeIntervalMicroSeconds& aDuration)
1.349 + {
1.350 + iDevSoundProxy->PlayToneL(aFrequency, aDuration);
1.351 + }
1.352 +
1.353 +/*
1.354 +* Initializes audio device and start playing a dual tone.
1.355 +* The tone consists of two sine waves of different frequencies summed together
1.356 +* Dual Tone is played with specified frequencies and for specified duration.
1.357 +*
1.358 +* @param "aFrequencyOne"
1.359 +* First frequency of dual tone
1.360 +*
1.361 +* @param "aFrequencyTwo"
1.362 +* Second frequency of dual tone
1.363 +*
1.364 +* @param "aDuration"
1.365 +* The period over which the tone will be played. A zero value causes
1.366 +* the no tone to be played (Verify this with test app).
1.367 +*/
1.368 +inline void CMMFDevSound::CBody::PlayDualToneL(
1.369 + TInt aFrequencyOne,
1.370 + TInt aFrequencyTwo,
1.371 + const TTimeIntervalMicroSeconds& aDuration)
1.372 + {
1.373 + iDevSoundProxy->PlayDualToneL(aFrequencyOne, aFrequencyTwo, aDuration);
1.374 + }
1.375 +
1.376 +/*
1.377 +* Initializes audio device and start playing DTMF string aDTMFString.
1.378 +*
1.379 +* Leaves on failure.
1.380 +*
1.381 +* @param "aDTMFString"
1.382 +* DTMF sequence in a descriptor.
1.383 +*/
1.384 +inline void CMMFDevSound::CBody::PlayDTMFStringL(const TDesC& aDTMFString)
1.385 + {
1.386 + iDevSoundProxy->PlayDTMFStringL(aDTMFString);
1.387 + }
1.388 +
1.389 +/*
1.390 +* Initializes audio device and start playing tone sequence.
1.391 +*
1.392 +* Leaves on failure.
1.393 +*
1.394 +* @param "TDesC8& aData"
1.395 +* Tone sequence in a descriptor.
1.396 +*/
1.397 +inline void CMMFDevSound::CBody::PlayToneSequenceL(const TDesC8& aData)
1.398 + {
1.399 + iDevSoundProxy->PlayToneSequenceL(aData);
1.400 + }
1.401 +
1.402 +/*
1.403 +* Defines the number of times the audio is to be repeated during the tone
1.404 +* playback operation.
1.405 +*
1.406 +* A period of silence can follow each playing of tone. The tone playing can
1.407 +* be repeated indefinitely.
1.408 +*
1.409 +* @param " aRepeatCount"
1.410 +* The number of times the tone, together with the trailing silence,
1.411 +* is to be repeated. If this is set to KMdaRepeatForever, then the
1.412 +* tone, together with the trailing silence, is repeated indefinitely
1.413 +* or until Stop() is called. If this is set to zero, then the tone is
1.414 +* not repeated.
1.415 +*
1.416 +* Supported only during tone playing.
1.417 +*/
1.418 +inline void CMMFDevSound::CBody::SetToneRepeats(
1.419 + TInt aRepeatCount,
1.420 + const TTimeIntervalMicroSeconds& aRepeatTrailingSilence)
1.421 + {
1.422 + iDevSoundProxy->SetToneRepeats(aRepeatCount, aRepeatTrailingSilence);
1.423 + }
1.424 +
1.425 +/*
1.426 +* Defines the duration of tone on, tone off and tone pause to be used during
1.427 +* the DTMF tone playback operation.
1.428 +*
1.429 +* Supported only during tone playing.
1.430 +*
1.431 +* @param "aToneOnLength"
1.432 +* The period over which the tone will be played. If this is set to
1.433 +* zero, then the tone is not played.
1.434 +*
1.435 +* @param "aToneOffLength"
1.436 +* The period over which the no tone will be played.
1.437 +*
1.438 +* @param "aPauseLength"
1.439 +* The period over which the tone playing will be paused.
1.440 +*/
1.441 +inline void CMMFDevSound::CBody::SetDTMFLengths(
1.442 + TTimeIntervalMicroSeconds32& aToneOnLength,
1.443 + TTimeIntervalMicroSeconds32& aToneOffLength,
1.444 + TTimeIntervalMicroSeconds32& aPauseLength)
1.445 + {
1.446 + iDevSoundProxy->SetDTMFLengths(aToneOnLength,
1.447 + aToneOffLength,
1.448 + aPauseLength);
1.449 + }
1.450 +
1.451 +/*
1.452 +* Defines the period over which the volume level is to rise smoothly from
1.453 +* nothing to the normal volume level.
1.454 +*
1.455 +* @param "aRampDuration"
1.456 +* The period over which the volume is to rise. A zero value causes
1.457 +* the tone sample to be played at the normal level for the full
1.458 +* duration of the playback. A value, which is longer than the duration
1.459 +* of the tone sample, that the sample never reaches its normal
1.460 +* volume level.
1.461 +*/
1.462 +inline void CMMFDevSound::CBody::SetVolumeRamp(
1.463 + const TTimeIntervalMicroSeconds& aRampDuration)
1.464 + {
1.465 + iDevSoundProxy->SetVolumeRamp(aRampDuration);
1.466 + }
1.467 +
1.468 +/*
1.469 +* Defines the priority settings that should be used for this instance.
1.470 +*
1.471 +* @param "aPrioritySettings"
1.472 +* An class type representing the client's priority, priority
1.473 +* preference and state.
1.474 +*/
1.475 +inline void CMMFDevSound::CBody::SetPrioritySettings(
1.476 + const TMMFPrioritySettings& aPrioritySettings)
1.477 + {
1.478 + iDevSoundProxy->SetPrioritySettings(aPrioritySettings);
1.479 + }
1.480 +
1.481 +
1.482 +/*
1.483 +* Returns a list of supported input data types that can be sent to the
1.484 +* DevSound for playing audio.
1.485 +*/
1.486 +inline void CMMFDevSound::CBody::GetSupportedInputDataTypesL(
1.487 + RArray<TFourCC>& aSupportedDataTypes,
1.488 + const TMMFPrioritySettings& aPrioritySettings) const
1.489 + {
1.490 + iDevSoundProxy->GetSupportedInputDataTypesL(aSupportedDataTypes,
1.491 + aPrioritySettings);
1.492 + }
1.493 +
1.494 +
1.495 +/*
1.496 +* Returns a list of supported output data types that can be received from
1.497 +* the DevSound for recording audio.
1.498 +*/
1.499 +inline void CMMFDevSound::CBody::GetSupportedOutputDataTypesL(
1.500 + RArray<TFourCC>& aSupportedDataTypes,
1.501 + const TMMFPrioritySettings& aPrioritySettings) const
1.502 + {
1.503 + iDevSoundProxy->GetSupportedOutputDataTypesL(aSupportedDataTypes,
1.504 + aPrioritySettings);
1.505 + }
1.506 +
1.507 +/* Registers the client for notification
1.508 +*/
1.509 +inline TInt CMMFDevSound::CBody::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData)
1.510 + {
1.511 + return iDevSoundProxy->RegisterAsClient(aEventType,aNotificationRegistrationData);
1.512 + }
1.513 +/* Cancels the registered notification
1.514 +*/
1.515 +inline TInt CMMFDevSound::CBody::CancelRegisterAsClient(TUid aEventType)
1.516 + {
1.517 + return iDevSoundProxy->CancelRegisterAsClient(aEventType);
1.518 + }
1.519 +
1.520 +/* Get the notification data to resume
1.521 +*/
1.522 +inline TInt CMMFDevSound::CBody::GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData)
1.523 + {
1.524 + return iDevSoundProxy->GetResourceNotificationData(aEventType,aNotificationData);
1.525 + }
1.526 +
1.527 +/*if client need more than the default timeout period
1.528 +*/
1.529 +inline TInt CMMFDevSound::CBody::WillResumePlay()
1.530 + {
1.531 + return iDevSoundProxy->WillResumePlay();
1.532 + }
1.533 +
1.534 +/*
1.535 + * Empties the buffers below DevSound without
1.536 + * causing the codec to be deleted.
1.537 +*/
1.538 +inline TInt CMMFDevSound::CBody::EmptyBuffers()
1.539 + {
1.540 + return iDevSoundProxy->EmptyBuffers();
1.541 + }
1.542 +
1.543 +/*
1.544 + * Cancels the initialization process
1.545 +*/
1.546 +inline TInt CMMFDevSound::CBody::CancelInitialize()
1.547 + {
1.548 + return iDevSoundProxy->CancelInitialize();
1.549 + }
1.550 +
1.551 +/*
1.552 +* Queries about if Resume operation is supported
1.553 +*/
1.554 +inline TBool CMMFDevSound::CBody::IsResumeSupported()
1.555 + {
1.556 + return iDevSoundProxy->IsResumeSupported();
1.557 + }
1.558 +
1.559 +/*
1.560 +* Resume the temporarily stoppped ongoing operation (Play, Record, TonePlay)
1.561 +*/
1.562 +inline TInt CMMFDevSound::CBody::Resume()
1.563 + {
1.564 + return iDevSoundProxy->Resume();
1.565 + }
1.566 +
1.567 +inline TInt CMMFDevSound::CBody::SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
1.568 + {
1.569 + return iDevSoundProxy->SyncCustomCommand(aUid, aParam1, aParam2, aOutParam);
1.570 + }
1.571 +
1.572 +inline void CMMFDevSound::CBody::AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
1.573 + {
1.574 + iDevSoundProxy->AsyncCustomCommand(aUid, aStatus, aParam1, aParam2, aOutParam);
1.575 + }
1.576 +
1.577 +#endif // SOUNDDEVICEBODY_INL
1.578 +
1.579 +// End of File