sl@0: /* sl@0: * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: #ifndef SOUNDDEVICEBODY_INL sl@0: #define SOUNDDEVICEBODY_INL sl@0: sl@0: /* sl@0: * sl@0: * Returns the supported Audio settings. sl@0: * sl@0: * @return "TMMFCapabilities" sl@0: * Device settings. sl@0: */ sl@0: inline TMMFCapabilities CMMFDevSound::CBody::Capabilities() sl@0: { sl@0: return iDevSoundProxy->Capabilities(); sl@0: } sl@0: sl@0: /* sl@0: * Returns the current audio settings. sl@0: * sl@0: * @return "TMMFCapabilities" sl@0: * Device settings. sl@0: */ sl@0: inline TMMFCapabilities CMMFDevSound::CBody::Config() const sl@0: { sl@0: return iDevSoundProxy->Config(); sl@0: } sl@0: sl@0: /* sl@0: * Configure CMMFDevSound::CBody object for the settings in aConfig. sl@0: * sl@0: * Use this to set sampling rate, Encoding and Mono/Stereo. sl@0: * sl@0: * @param "aConfig" sl@0: * Attribute values to which CMMFDevSound::CBody object will be sl@0: * configured to. sl@0: */ sl@0: inline void CMMFDevSound::CBody::SetConfigL(const TMMFCapabilities& aConfig) sl@0: { sl@0: iDevSoundProxy->SetConfigL(aConfig); sl@0: } sl@0: sl@0: /* sl@0: * Returns an integer representing the maximum volume. sl@0: * sl@0: * This is the maximum value which can be passed to sl@0: * CMMFDevSound::CBody::SetVolume. sl@0: * sl@0: * @return "TInt" sl@0: * The maximum volume. This value is platform dependent but is always sl@0: * greater than or equal to one. sl@0: * sl@0: */ sl@0: inline TInt CMMFDevSound::CBody::MaxVolume() sl@0: { sl@0: return iDevSoundProxy->MaxVolume(); sl@0: } sl@0: sl@0: /* sl@0: * Returns an integer representing the current volume. sl@0: * sl@0: * @return "TInt" sl@0: * The current volume level. sl@0: */ sl@0: inline TInt CMMFDevSound::CBody::Volume() sl@0: { sl@0: return iDevSoundProxy->Volume(); sl@0: } sl@0: sl@0: /* sl@0: * Changes the current playback volume to a specified value. sl@0: * sl@0: * The volume can be changed before or during playback and is effective sl@0: * immediately. sl@0: * sl@0: * @param "aVolume" sl@0: * The volume setting. This can be any value from zero to the value sl@0: * returned by a call to CMMFDevSound::CBody::MaxVolume(). If the sl@0: * volume is not within this range, the volume is automatically set to sl@0: * minimum or maximum value based on the value that is being passed. sl@0: * Setting a zero value mutes the sound. Setting the maximum value sl@0: * results in the loudest possible sound. sl@0: */ sl@0: inline void CMMFDevSound::CBody::SetVolume(TInt aVolume) sl@0: { sl@0: iDevSoundProxy->SetVolume(aVolume); sl@0: } sl@0: sl@0: /* sl@0: * Returns an integer representing the maximum gain. sl@0: * sl@0: * This is the maximum value which can be passed to sl@0: * CMMFDevSound::CBody::SetGain. sl@0: * sl@0: * @return "TInt" sl@0: * The maximum gain. This value is platform dependent but is always sl@0: * greater than or equal to one. sl@0: * sl@0: */ sl@0: inline TInt CMMFDevSound::CBody::MaxGain() sl@0: { sl@0: return iDevSoundProxy->MaxGain(); sl@0: } sl@0: sl@0: /* sl@0: * Returns an integer representing the current gain. sl@0: * sl@0: * @return "TInt" sl@0: * The current gain level. sl@0: */ sl@0: inline TInt CMMFDevSound::CBody::Gain() sl@0: { sl@0: return iDevSoundProxy->Gain(); sl@0: } sl@0: sl@0: /* sl@0: * Changes the current recording gain to a specified value. sl@0: * sl@0: * The gain can be changed before or during recording and is effective sl@0: * immediately. sl@0: * sl@0: * @param "TInt aGain" sl@0: * The gain setting. This can be any value from zero to the value sl@0: * returned by a call to CMMFDevSound::CBody::MaxGain(). If the sl@0: * volume is not within this range, the gain is automatically set to sl@0: * minimum or maximum value based on the value that is being passed. sl@0: * Setting a zero value mutes the sound. Setting the maximum value sl@0: * results in the loudest possible sound. sl@0: */ sl@0: inline void CMMFDevSound::CBody::SetGain(TInt aGain) sl@0: { sl@0: iDevSoundProxy->SetGain(aGain); sl@0: } sl@0: sl@0: /* sl@0: * Returns the speaker balance set for playing. sl@0: * sl@0: * Leaves on failure. sl@0: * sl@0: * @param "aLeftPrecentage" sl@0: * On return contains the left speaker volume percentage. sl@0: * sl@0: * @param "aRightPercentage" sl@0: * On return contains the right speaker volume percentage. sl@0: */ sl@0: inline void CMMFDevSound::CBody::GetPlayBalanceL(TInt& aLeftPercentage, sl@0: TInt& aRightPercentage) sl@0: { sl@0: iDevSoundProxy->GetPlayBalanceL(aLeftPercentage, aRightPercentage); sl@0: } sl@0: sl@0: /* sl@0: * Sets the speaker balance for playing. sl@0: * sl@0: * The speaker balance can be changed before or during playback and is sl@0: * effective immediately. sl@0: * sl@0: * @param "aLeftPercentage" sl@0: * On return contains left speaker volume perecentage. This can be any sl@0: * value from zero to 100. Setting a zero value mutes the sound on left sl@0: * speaker. sl@0: * sl@0: * @param "aRightPercentage" sl@0: * On return contains right speaker volume perecentage. This can be any sl@0: * value from zero to 100. Setting a zero value mutes the sound on sl@0: * right speaker. sl@0: */ sl@0: inline void CMMFDevSound::CBody::SetPlayBalanceL(TInt aLeftPercentage, sl@0: TInt aRightPercentage) sl@0: { sl@0: iDevSoundProxy->SetPlayBalanceL(aLeftPercentage, aRightPercentage); sl@0: } sl@0: sl@0: /* sl@0: * Returns the microphone gain balance set for recording. sl@0: * sl@0: * Leaves on failure. sl@0: * sl@0: * @param "aLeftPercentage" sl@0: * On return contains the left microphone gain percentage. sl@0: * sl@0: * @param "aRightPercentage" sl@0: * On return contains the right microphone gain percentage. sl@0: */ sl@0: inline void CMMFDevSound::CBody::GetRecordBalanceL( sl@0: TInt& aLeftPercentage, sl@0: TInt& aRightPercentage) sl@0: { sl@0: iDevSoundProxy->GetRecordBalanceL(aLeftPercentage, aRightPercentage); sl@0: } sl@0: sl@0: /* sl@0: * Sets the microphone gain balance for recording. sl@0: * sl@0: * The microphone gain balance can be changed before or during recording and sl@0: * is effective immediately. sl@0: * sl@0: * @param "aLeftPercentage" sl@0: * Left microphone gain precentage. This can be any value from zero to sl@0: * 100. Setting a zero value mutes the gain on left microphone. sl@0: * sl@0: * @param "aRightPercentage" sl@0: * Right microphone gain precentage. This can be any value from zero to sl@0: * 100. Setting a zero value mutes the gain on right microphone. sl@0: */ sl@0: inline void CMMFDevSound::CBody::SetRecordBalanceL(TInt aLeftPercentage, sl@0: TInt aRightPercentage) sl@0: { sl@0: iDevSoundProxy->SetRecordBalanceL(aLeftPercentage, aRightPercentage); sl@0: } sl@0: sl@0: /* sl@0: * Initializes audio device and start play process. This method queries and sl@0: * acquires the audio policy before initializing audio device. If there was an sl@0: * error during policy initialization, PlayError() method will be called on sl@0: * the observer with error code KErrAccessDenied, otherwise BufferToBeFilled() sl@0: * method will be called with a buffer reference. After reading data into the sl@0: * buffer reference passed, the client should call PlayData() to play data. sl@0: * sl@0: * The amount of data that can be played is specified in sl@0: * CMMFBuffer::RequestSize(). Any data that is read into buffer beyond this sl@0: * size will be ignored. sl@0: * sl@0: * Leaves on failure. sl@0: */ sl@0: inline void CMMFDevSound::CBody::PlayInitL() sl@0: { sl@0: iDevSoundProxy->PlayInitL(); sl@0: } sl@0: sl@0: /* sl@0: * Initializes audio device and start record process. This method queries and sl@0: * acquires the audio policy before initializing audio device. If there was an sl@0: * error during policy initialization, RecordError() method will be called on sl@0: * the observer with error code KErrAccessDenied, otherwise BufferToBeEmptied() sl@0: * method will be called with a buffer reference. This buffer contains recorded sl@0: * or encoded data. After processing data in the buffer reference passed, the sl@0: * client should call RecordData() to continue recording process. sl@0: * sl@0: * The amount of data that is available is specified in sl@0: * CMMFBuffer::RequestSize(). sl@0: * sl@0: * Leaves on failure. sl@0: */ sl@0: inline void CMMFDevSound::CBody::RecordInitL() sl@0: { sl@0: iDevSoundProxy->RecordInitL(); sl@0: } sl@0: sl@0: /* sl@0: * Plays data in the buffer at the current volume. The client should fill sl@0: * the buffer with audio data before calling this method. The Observer gets sl@0: * reference to buffer along with callback BufferToBeFilled(). When playing of sl@0: * the audio sample is complete, successfully or otherwise, the method sl@0: * PlayError() on observer is called. sl@0: */ sl@0: inline void CMMFDevSound::CBody::PlayData() sl@0: { sl@0: iDevSoundProxy->PlayData(); sl@0: } sl@0: sl@0: /* sl@0: * Contine the process of recording. Once the buffer is filled with recorded sl@0: * data, the Observer gets reference to buffer along with callback sl@0: * BufferToBeEmptied(). After processing the buffer (copying over to a sl@0: * different buffer or writing to file) the client should call this sl@0: * method to continue recording process. sl@0: */ sl@0: inline void CMMFDevSound::CBody::RecordData() sl@0: { sl@0: iDevSoundProxy->RecordData(); sl@0: } sl@0: sl@0: /* sl@0: * Stops the ongoing operation (Play, Record, TonePlay) sl@0: */ sl@0: inline void CMMFDevSound::CBody::Stop() sl@0: { sl@0: iDevSoundProxy->Stop(); sl@0: } sl@0: sl@0: /* sl@0: * Temporarily Stops the ongoing operation (Play, Record, TonePlay) sl@0: */ sl@0: inline void CMMFDevSound::CBody::Pause() sl@0: { sl@0: iDevSoundProxy->Pause(); sl@0: } sl@0: sl@0: /* sl@0: * Returns the sample recorded so far. sl@0: * sl@0: * @return "TInt" sl@0: * Returns the samples recorded. sl@0: */ sl@0: inline TInt CMMFDevSound::CBody::SamplesRecorded() sl@0: { sl@0: return iDevSoundProxy->SamplesRecorded(); sl@0: } sl@0: sl@0: /* sl@0: * Returns the sample played so far. sl@0: * sl@0: * @return "TInt" sl@0: * Returns the samples recorded. sl@0: */ sl@0: inline TInt CMMFDevSound::CBody::SamplesPlayed() sl@0: { sl@0: return iDevSoundProxy->SamplesPlayed(); sl@0: } sl@0: sl@0: sl@0: /* sl@0: * Initializes audio device and start playing tone. Tone is played with sl@0: * frequency and for duration specified. sl@0: * sl@0: * Leaves on failure. sl@0: * sl@0: * @param "aFrequency" sl@0: * Frequency at with the tone will be played. sl@0: * sl@0: * @param "aDuration" sl@0: * The period over which the tone will be played. A zero value causes sl@0: * the no tone to be played (Verify this with test app). sl@0: */ sl@0: inline void CMMFDevSound::CBody::PlayToneL( sl@0: TInt aFrequency, sl@0: const TTimeIntervalMicroSeconds& aDuration) sl@0: { sl@0: iDevSoundProxy->PlayToneL(aFrequency, aDuration); sl@0: } sl@0: sl@0: /* sl@0: * Initializes audio device and start playing a dual tone. sl@0: * The tone consists of two sine waves of different frequencies summed together sl@0: * Dual Tone is played with specified frequencies and for specified duration. sl@0: * sl@0: * @param "aFrequencyOne" sl@0: * First frequency of dual tone sl@0: * sl@0: * @param "aFrequencyTwo" sl@0: * Second frequency of dual tone sl@0: * sl@0: * @param "aDuration" sl@0: * The period over which the tone will be played. A zero value causes sl@0: * the no tone to be played (Verify this with test app). sl@0: */ sl@0: inline void CMMFDevSound::CBody::PlayDualToneL( sl@0: TInt aFrequencyOne, sl@0: TInt aFrequencyTwo, sl@0: const TTimeIntervalMicroSeconds& aDuration) sl@0: { sl@0: iDevSoundProxy->PlayDualToneL(aFrequencyOne, aFrequencyTwo, aDuration); sl@0: } sl@0: sl@0: /* sl@0: * Initializes audio device and start playing DTMF string aDTMFString. sl@0: * sl@0: * Leaves on failure. sl@0: * sl@0: * @param "aDTMFString" sl@0: * DTMF sequence in a descriptor. sl@0: */ sl@0: inline void CMMFDevSound::CBody::PlayDTMFStringL(const TDesC& aDTMFString) sl@0: { sl@0: iDevSoundProxy->PlayDTMFStringL(aDTMFString); sl@0: } sl@0: sl@0: /* sl@0: * Initializes audio device and start playing tone sequence. sl@0: * sl@0: * Leaves on failure. sl@0: * sl@0: * @param "TDesC8& aData" sl@0: * Tone sequence in a descriptor. sl@0: */ sl@0: inline void CMMFDevSound::CBody::PlayToneSequenceL(const TDesC8& aData) sl@0: { sl@0: iDevSoundProxy->PlayToneSequenceL(aData); sl@0: } sl@0: sl@0: /* sl@0: * Defines the number of times the audio is to be repeated during the tone sl@0: * playback operation. sl@0: * sl@0: * A period of silence can follow each playing of tone. The tone playing can sl@0: * be repeated indefinitely. sl@0: * sl@0: * @param " aRepeatCount" sl@0: * The number of times the tone, together with the trailing silence, sl@0: * is to be repeated. If this is set to KMdaRepeatForever, then the sl@0: * tone, together with the trailing silence, is repeated indefinitely sl@0: * or until Stop() is called. If this is set to zero, then the tone is sl@0: * not repeated. sl@0: * sl@0: * Supported only during tone playing. sl@0: */ sl@0: inline void CMMFDevSound::CBody::SetToneRepeats( sl@0: TInt aRepeatCount, sl@0: const TTimeIntervalMicroSeconds& aRepeatTrailingSilence) sl@0: { sl@0: iDevSoundProxy->SetToneRepeats(aRepeatCount, aRepeatTrailingSilence); sl@0: } sl@0: sl@0: /* sl@0: * Defines the duration of tone on, tone off and tone pause to be used during sl@0: * the DTMF tone playback operation. sl@0: * sl@0: * Supported only during tone playing. sl@0: * sl@0: * @param "aToneOnLength" sl@0: * The period over which the tone will be played. If this is set to sl@0: * zero, then the tone is not played. sl@0: * sl@0: * @param "aToneOffLength" sl@0: * The period over which the no tone will be played. sl@0: * sl@0: * @param "aPauseLength" sl@0: * The period over which the tone playing will be paused. sl@0: */ sl@0: inline void CMMFDevSound::CBody::SetDTMFLengths( sl@0: TTimeIntervalMicroSeconds32& aToneOnLength, sl@0: TTimeIntervalMicroSeconds32& aToneOffLength, sl@0: TTimeIntervalMicroSeconds32& aPauseLength) sl@0: { sl@0: iDevSoundProxy->SetDTMFLengths(aToneOnLength, sl@0: aToneOffLength, sl@0: aPauseLength); sl@0: } sl@0: sl@0: /* sl@0: * Defines the period over which the volume level is to rise smoothly from sl@0: * nothing to the normal volume level. sl@0: * sl@0: * @param "aRampDuration" sl@0: * The period over which the volume is to rise. A zero value causes sl@0: * the tone sample to be played at the normal level for the full sl@0: * duration of the playback. A value, which is longer than the duration sl@0: * of the tone sample, that the sample never reaches its normal sl@0: * volume level. sl@0: */ sl@0: inline void CMMFDevSound::CBody::SetVolumeRamp( sl@0: const TTimeIntervalMicroSeconds& aRampDuration) sl@0: { sl@0: iDevSoundProxy->SetVolumeRamp(aRampDuration); sl@0: } sl@0: sl@0: /* sl@0: * Defines the priority settings that should be used for this instance. sl@0: * sl@0: * @param "aPrioritySettings" sl@0: * An class type representing the client's priority, priority sl@0: * preference and state. sl@0: */ sl@0: inline void CMMFDevSound::CBody::SetPrioritySettings( sl@0: const TMMFPrioritySettings& aPrioritySettings) sl@0: { sl@0: iDevSoundProxy->SetPrioritySettings(aPrioritySettings); sl@0: } sl@0: sl@0: sl@0: /* sl@0: * Returns a list of supported input data types that can be sent to the sl@0: * DevSound for playing audio. sl@0: */ sl@0: inline void CMMFDevSound::CBody::GetSupportedInputDataTypesL( sl@0: RArray& aSupportedDataTypes, sl@0: const TMMFPrioritySettings& aPrioritySettings) const sl@0: { sl@0: iDevSoundProxy->GetSupportedInputDataTypesL(aSupportedDataTypes, sl@0: aPrioritySettings); sl@0: } sl@0: sl@0: sl@0: /* sl@0: * Returns a list of supported output data types that can be received from sl@0: * the DevSound for recording audio. sl@0: */ sl@0: inline void CMMFDevSound::CBody::GetSupportedOutputDataTypesL( sl@0: RArray& aSupportedDataTypes, sl@0: const TMMFPrioritySettings& aPrioritySettings) const sl@0: { sl@0: iDevSoundProxy->GetSupportedOutputDataTypesL(aSupportedDataTypes, sl@0: aPrioritySettings); sl@0: } sl@0: sl@0: /* Registers the client for notification sl@0: */ sl@0: inline TInt CMMFDevSound::CBody::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData) sl@0: { sl@0: return iDevSoundProxy->RegisterAsClient(aEventType,aNotificationRegistrationData); sl@0: } sl@0: /* Cancels the registered notification sl@0: */ sl@0: inline TInt CMMFDevSound::CBody::CancelRegisterAsClient(TUid aEventType) sl@0: { sl@0: return iDevSoundProxy->CancelRegisterAsClient(aEventType); sl@0: } sl@0: sl@0: /* Get the notification data to resume sl@0: */ sl@0: inline TInt CMMFDevSound::CBody::GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData) sl@0: { sl@0: return iDevSoundProxy->GetResourceNotificationData(aEventType,aNotificationData); sl@0: } sl@0: sl@0: /*if client need more than the default timeout period sl@0: */ sl@0: inline TInt CMMFDevSound::CBody::WillResumePlay() sl@0: { sl@0: return iDevSoundProxy->WillResumePlay(); sl@0: } sl@0: sl@0: /* sl@0: * Empties the buffers below DevSound without sl@0: * causing the codec to be deleted. sl@0: */ sl@0: inline TInt CMMFDevSound::CBody::EmptyBuffers() sl@0: { sl@0: return iDevSoundProxy->EmptyBuffers(); sl@0: } sl@0: sl@0: /* sl@0: * Cancels the initialization process sl@0: */ sl@0: inline TInt CMMFDevSound::CBody::CancelInitialize() sl@0: { sl@0: return iDevSoundProxy->CancelInitialize(); sl@0: } sl@0: sl@0: /* sl@0: * Queries about if Resume operation is supported sl@0: */ sl@0: inline TBool CMMFDevSound::CBody::IsResumeSupported() sl@0: { sl@0: return iDevSoundProxy->IsResumeSupported(); sl@0: } sl@0: sl@0: /* sl@0: * Resume the temporarily stoppped ongoing operation (Play, Record, TonePlay) sl@0: */ sl@0: inline TInt CMMFDevSound::CBody::Resume() sl@0: { sl@0: return iDevSoundProxy->Resume(); sl@0: } sl@0: sl@0: inline TInt CMMFDevSound::CBody::SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam) sl@0: { sl@0: return iDevSoundProxy->SyncCustomCommand(aUid, aParam1, aParam2, aOutParam); sl@0: } sl@0: sl@0: inline void CMMFDevSound::CBody::AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam) sl@0: { sl@0: iDevSoundProxy->AsyncCustomCommand(aUid, aStatus, aParam1, aParam2, aOutParam); sl@0: } sl@0: sl@0: #endif // SOUNDDEVICEBODY_INL sl@0: sl@0: // End of File