Update contrib.
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
20 #ifndef SOUNDDEVICEBODY_INL
21 #define SOUNDDEVICEBODY_INL
25 * Returns the supported Audio settings.
27 * @return "TMMFCapabilities"
30 inline TMMFCapabilities CMMFDevSound::CBody::Capabilities()
32 return iDevSoundProxy->Capabilities();
36 * Returns the current audio settings.
38 * @return "TMMFCapabilities"
41 inline TMMFCapabilities CMMFDevSound::CBody::Config() const
43 return iDevSoundProxy->Config();
47 * Configure CMMFDevSound::CBody object for the settings in aConfig.
49 * Use this to set sampling rate, Encoding and Mono/Stereo.
52 * Attribute values to which CMMFDevSound::CBody object will be
55 inline void CMMFDevSound::CBody::SetConfigL(const TMMFCapabilities& aConfig)
57 iDevSoundProxy->SetConfigL(aConfig);
61 * Returns an integer representing the maximum volume.
63 * This is the maximum value which can be passed to
64 * CMMFDevSound::CBody::SetVolume.
67 * The maximum volume. This value is platform dependent but is always
68 * greater than or equal to one.
71 inline TInt CMMFDevSound::CBody::MaxVolume()
73 return iDevSoundProxy->MaxVolume();
77 * Returns an integer representing the current volume.
80 * The current volume level.
82 inline TInt CMMFDevSound::CBody::Volume()
84 return iDevSoundProxy->Volume();
88 * Changes the current playback volume to a specified value.
90 * The volume can be changed before or during playback and is effective
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.
101 inline void CMMFDevSound::CBody::SetVolume(TInt aVolume)
103 iDevSoundProxy->SetVolume(aVolume);
107 * Returns an integer representing the maximum gain.
109 * This is the maximum value which can be passed to
110 * CMMFDevSound::CBody::SetGain.
113 * The maximum gain. This value is platform dependent but is always
114 * greater than or equal to one.
117 inline TInt CMMFDevSound::CBody::MaxGain()
119 return iDevSoundProxy->MaxGain();
123 * Returns an integer representing the current gain.
126 * The current gain level.
128 inline TInt CMMFDevSound::CBody::Gain()
130 return iDevSoundProxy->Gain();
134 * Changes the current recording gain to a specified value.
136 * The gain can be changed before or during recording and is effective
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.
147 inline void CMMFDevSound::CBody::SetGain(TInt aGain)
149 iDevSoundProxy->SetGain(aGain);
153 * Returns the speaker balance set for playing.
157 * @param "aLeftPrecentage"
158 * On return contains the left speaker volume percentage.
160 * @param "aRightPercentage"
161 * On return contains the right speaker volume percentage.
163 inline void CMMFDevSound::CBody::GetPlayBalanceL(TInt& aLeftPercentage,
164 TInt& aRightPercentage)
166 iDevSoundProxy->GetPlayBalanceL(aLeftPercentage, aRightPercentage);
170 * Sets the speaker balance for playing.
172 * The speaker balance can be changed before or during playback and is
173 * effective immediately.
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
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
185 inline void CMMFDevSound::CBody::SetPlayBalanceL(TInt aLeftPercentage,
186 TInt aRightPercentage)
188 iDevSoundProxy->SetPlayBalanceL(aLeftPercentage, aRightPercentage);
192 * Returns the microphone gain balance set for recording.
196 * @param "aLeftPercentage"
197 * On return contains the left microphone gain percentage.
199 * @param "aRightPercentage"
200 * On return contains the right microphone gain percentage.
202 inline void CMMFDevSound::CBody::GetRecordBalanceL(
203 TInt& aLeftPercentage,
204 TInt& aRightPercentage)
206 iDevSoundProxy->GetRecordBalanceL(aLeftPercentage, aRightPercentage);
210 * Sets the microphone gain balance for recording.
212 * The microphone gain balance can be changed before or during recording and
213 * is effective immediately.
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.
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.
223 inline void CMMFDevSound::CBody::SetRecordBalanceL(TInt aLeftPercentage,
224 TInt aRightPercentage)
226 iDevSoundProxy->SetRecordBalanceL(aLeftPercentage, aRightPercentage);
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.
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.
243 inline void CMMFDevSound::CBody::PlayInitL()
245 iDevSoundProxy->PlayInitL();
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.
257 * The amount of data that is available is specified in
258 * CMMFBuffer::RequestSize().
262 inline void CMMFDevSound::CBody::RecordInitL()
264 iDevSoundProxy->RecordInitL();
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.
274 inline void CMMFDevSound::CBody::PlayData()
276 iDevSoundProxy->PlayData();
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.
286 inline void CMMFDevSound::CBody::RecordData()
288 iDevSoundProxy->RecordData();
292 * Stops the ongoing operation (Play, Record, TonePlay)
294 inline void CMMFDevSound::CBody::Stop()
296 iDevSoundProxy->Stop();
300 * Temporarily Stops the ongoing operation (Play, Record, TonePlay)
302 inline void CMMFDevSound::CBody::Pause()
304 iDevSoundProxy->Pause();
308 * Returns the sample recorded so far.
311 * Returns the samples recorded.
313 inline TInt CMMFDevSound::CBody::SamplesRecorded()
315 return iDevSoundProxy->SamplesRecorded();
319 * Returns the sample played so far.
322 * Returns the samples recorded.
324 inline TInt CMMFDevSound::CBody::SamplesPlayed()
326 return iDevSoundProxy->SamplesPlayed();
331 * Initializes audio device and start playing tone. Tone is played with
332 * frequency and for duration specified.
336 * @param "aFrequency"
337 * Frequency at with the tone will be played.
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).
343 inline void CMMFDevSound::CBody::PlayToneL(
345 const TTimeIntervalMicroSeconds& aDuration)
347 iDevSoundProxy->PlayToneL(aFrequency, aDuration);
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.
355 * @param "aFrequencyOne"
356 * First frequency of dual tone
358 * @param "aFrequencyTwo"
359 * Second frequency of dual tone
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).
365 inline void CMMFDevSound::CBody::PlayDualToneL(
368 const TTimeIntervalMicroSeconds& aDuration)
370 iDevSoundProxy->PlayDualToneL(aFrequencyOne, aFrequencyTwo, aDuration);
374 * Initializes audio device and start playing DTMF string aDTMFString.
378 * @param "aDTMFString"
379 * DTMF sequence in a descriptor.
381 inline void CMMFDevSound::CBody::PlayDTMFStringL(const TDesC& aDTMFString)
383 iDevSoundProxy->PlayDTMFStringL(aDTMFString);
387 * Initializes audio device and start playing tone sequence.
391 * @param "TDesC8& aData"
392 * Tone sequence in a descriptor.
394 inline void CMMFDevSound::CBody::PlayToneSequenceL(const TDesC8& aData)
396 iDevSoundProxy->PlayToneSequenceL(aData);
400 * Defines the number of times the audio is to be repeated during the tone
401 * playback operation.
403 * A period of silence can follow each playing of tone. The tone playing can
404 * be repeated indefinitely.
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
413 * Supported only during tone playing.
415 inline void CMMFDevSound::CBody::SetToneRepeats(
417 const TTimeIntervalMicroSeconds& aRepeatTrailingSilence)
419 iDevSoundProxy->SetToneRepeats(aRepeatCount, aRepeatTrailingSilence);
423 * Defines the duration of tone on, tone off and tone pause to be used during
424 * the DTMF tone playback operation.
426 * Supported only during tone playing.
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.
432 * @param "aToneOffLength"
433 * The period over which the no tone will be played.
435 * @param "aPauseLength"
436 * The period over which the tone playing will be paused.
438 inline void CMMFDevSound::CBody::SetDTMFLengths(
439 TTimeIntervalMicroSeconds32& aToneOnLength,
440 TTimeIntervalMicroSeconds32& aToneOffLength,
441 TTimeIntervalMicroSeconds32& aPauseLength)
443 iDevSoundProxy->SetDTMFLengths(aToneOnLength,
449 * Defines the period over which the volume level is to rise smoothly from
450 * nothing to the normal volume level.
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
459 inline void CMMFDevSound::CBody::SetVolumeRamp(
460 const TTimeIntervalMicroSeconds& aRampDuration)
462 iDevSoundProxy->SetVolumeRamp(aRampDuration);
466 * Defines the priority settings that should be used for this instance.
468 * @param "aPrioritySettings"
469 * An class type representing the client's priority, priority
470 * preference and state.
472 inline void CMMFDevSound::CBody::SetPrioritySettings(
473 const TMMFPrioritySettings& aPrioritySettings)
475 iDevSoundProxy->SetPrioritySettings(aPrioritySettings);
480 * Returns a list of supported input data types that can be sent to the
481 * DevSound for playing audio.
483 inline void CMMFDevSound::CBody::GetSupportedInputDataTypesL(
484 RArray<TFourCC>& aSupportedDataTypes,
485 const TMMFPrioritySettings& aPrioritySettings) const
487 iDevSoundProxy->GetSupportedInputDataTypesL(aSupportedDataTypes,
493 * Returns a list of supported output data types that can be received from
494 * the DevSound for recording audio.
496 inline void CMMFDevSound::CBody::GetSupportedOutputDataTypesL(
497 RArray<TFourCC>& aSupportedDataTypes,
498 const TMMFPrioritySettings& aPrioritySettings) const
500 iDevSoundProxy->GetSupportedOutputDataTypesL(aSupportedDataTypes,
504 /* Registers the client for notification
506 inline TInt CMMFDevSound::CBody::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData)
508 return iDevSoundProxy->RegisterAsClient(aEventType,aNotificationRegistrationData);
510 /* Cancels the registered notification
512 inline TInt CMMFDevSound::CBody::CancelRegisterAsClient(TUid aEventType)
514 return iDevSoundProxy->CancelRegisterAsClient(aEventType);
517 /* Get the notification data to resume
519 inline TInt CMMFDevSound::CBody::GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData)
521 return iDevSoundProxy->GetResourceNotificationData(aEventType,aNotificationData);
524 /*if client need more than the default timeout period
526 inline TInt CMMFDevSound::CBody::WillResumePlay()
528 return iDevSoundProxy->WillResumePlay();
532 * Empties the buffers below DevSound without
533 * causing the codec to be deleted.
535 inline TInt CMMFDevSound::CBody::EmptyBuffers()
537 return iDevSoundProxy->EmptyBuffers();
541 * Cancels the initialization process
543 inline TInt CMMFDevSound::CBody::CancelInitialize()
545 return iDevSoundProxy->CancelInitialize();
549 * Queries about if Resume operation is supported
551 inline TBool CMMFDevSound::CBody::IsResumeSupported()
553 return iDevSoundProxy->IsResumeSupported();
557 * Resume the temporarily stoppped ongoing operation (Play, Record, TonePlay)
559 inline TInt CMMFDevSound::CBody::Resume()
561 return iDevSoundProxy->Resume();
564 inline TInt CMMFDevSound::CBody::SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
566 return iDevSoundProxy->SyncCustomCommand(aUid, aParam1, aParam2, aOutParam);
569 inline void CMMFDevSound::CBody::AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
571 iDevSoundProxy->AsyncCustomCommand(aUid, aStatus, aParam1, aParam2, aOutParam);
574 #endif // SOUNDDEVICEBODY_INL