sl@0: // Copyright (c) 2001-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: // Initializes DevSound object for the mode aMode for processing audio data sl@0: // with hardware device aHWDev. sl@0: // On completion of Initialization, the observer will be notified via call back sl@0: // InitializeComplete(). sl@0: // Leaves on failure. sl@0: // @param "MDevSoundObserver& aDevSoundObserver" sl@0: // A reference to DevSound Observer instance. sl@0: // @param "TUid aHWDev" sl@0: // CMMFHwDevice implementation identifier. sl@0: // @param "TMMFState aMode" sl@0: // Mode for which this object will be used. sl@0: // sl@0: // sl@0: sl@0: inline void CMMFDevSoundClientImp::InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode) sl@0: { sl@0: TInt initError = KErrNone; sl@0: iDevSoundObserver = &aDevSoundObserver; sl@0: initError = iDevSoundProxy->InitializeL(aHWDev, aMode); sl@0: sl@0: if (initError) sl@0: { sl@0: User::Leave(initError); sl@0: } sl@0: sl@0: if (iMsgQueueHandler) sl@0: { sl@0: iMsgQueueHandler->Cancel(); sl@0: iMsgQueueHandler->SetObserver(*iDevSoundObserver); sl@0: } sl@0: else sl@0: { sl@0: iMsgQueueHandler = CMsgQueueHandler::NewL(iDevSoundProxy, *iDevSoundObserver, &iMsgQueue, *this); sl@0: } sl@0: sl@0: iMsgQueueHandler->ReceiveEvents(); sl@0: } sl@0: sl@0: /* sl@0: * sl@0: * Initializes DevSound object for the mode aMode for processing audio data sl@0: * with hardware device supporting FourCC aDesiredFourCC. sl@0: * sl@0: * On completion of Initialization, the observer will be notified via call back sl@0: * InitializeComplete(). sl@0: * sl@0: * Leaves on failure. sl@0: * sl@0: * @param "MDevSoundObserver& aDevSoundObserver" sl@0: * A reference to DevSound Observer instance. sl@0: * sl@0: * @param "TFourCC aDesiredFourCC" sl@0: * CMMFHwDevice implementation FourCC. sl@0: * sl@0: * @param "TMMFState aMode" sl@0: * Mode for which this object will be used. sl@0: * sl@0: */ sl@0: inline void CMMFDevSoundClientImp::InitializeL(MDevSoundObserver& aDevSoundObserver, sl@0: TFourCC aDesiredFourCC, TMMFState aMode) sl@0: { sl@0: TInt initError = KErrNone; sl@0: iDevSoundObserver = &aDevSoundObserver; sl@0: sl@0: initError = iDevSoundProxy->InitializeL(aDesiredFourCC, aMode); sl@0: sl@0: if (initError) sl@0: { sl@0: User::Leave(initError); sl@0: } sl@0: sl@0: if (iMsgQueueHandler) sl@0: { sl@0: iMsgQueueHandler->Cancel(); sl@0: iMsgQueueHandler->SetObserver(*iDevSoundObserver); sl@0: } sl@0: else sl@0: { sl@0: iMsgQueueHandler = CMsgQueueHandler::NewL(iDevSoundProxy, *iDevSoundObserver, &iMsgQueue, *this); sl@0: } sl@0: iMsgQueueHandler->ReceiveEvents(); sl@0: } 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: */ sl@0: inline TMMFCapabilities CMMFDevSoundClientImp::Capabilities() sl@0: { sl@0: return iDevSoundProxy->Capabilities(); sl@0: } 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: */ sl@0: inline TMMFCapabilities CMMFDevSoundClientImp::Config() const sl@0: { sl@0: return iDevSoundProxy->Config(); sl@0: } 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 CMMFDevSound::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 CMMFDevSoundClientImp::MaxVolume() sl@0: { sl@0: return iDevSoundProxy->MaxVolume(); sl@0: } 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: */ sl@0: inline TInt CMMFDevSoundClientImp::Volume() sl@0: { sl@0: return iDevSoundProxy->Volume(); sl@0: } 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 CMMFDevSound::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 CMMFDevSoundClientImp::MaxGain() sl@0: { sl@0: return iDevSoundProxy->MaxGain(); sl@0: } 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: */ sl@0: inline TInt CMMFDevSoundClientImp::Gain() sl@0: { sl@0: return iDevSoundProxy->Gain(); sl@0: } 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 "TInt& aLeftPercentage" sl@0: * On return contains the left speaker volume percentage. sl@0: * sl@0: * @param "TInt& aRightPercentage" sl@0: * On return contains the right speaker volume percentage. sl@0: * sl@0: */ sl@0: inline void CMMFDevSoundClientImp::GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) sl@0: { sl@0: iDevSoundProxy->GetPlayBalanceL(aLeftPercentage, aRightPercentage); sl@0: } 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 "TInt& aLeftPercentage" sl@0: * On return contains the left microphone gain percentage. sl@0: * sl@0: * @param "TInt& aRightPercentage" sl@0: * On return contains the right microphone gain percentage. sl@0: * sl@0: */ sl@0: inline void CMMFDevSoundClientImp::GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) sl@0: { sl@0: iDevSoundProxy->GetRecordBalanceL(aLeftPercentage, aRightPercentage); sl@0: } 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: */ sl@0: inline void CMMFDevSoundClientImp::RecordData() sl@0: { sl@0: ASSERT(iDevSoundObserver); sl@0: iDevSoundProxy->RecordData(); sl@0: } 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 "TInt 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: */ sl@0: inline void CMMFDevSoundClientImp::SetToneRepeats(TInt aRepeatCount, sl@0: const TTimeIntervalMicroSeconds& aRepeatTrailingSilence) sl@0: { sl@0: iDevSoundProxy->SetToneRepeats(aRepeatCount, aRepeatTrailingSilence); sl@0: } sl@0: sl@0: /* sl@0: * sl@0: * Defines the priority settings that should be used for this instance. sl@0: * sl@0: * @param "const TMMFPrioritySettings& aPrioritySettings" sl@0: * An class type representing the client's priority, priority sl@0: * preference and state. sl@0: * sl@0: */ sl@0: inline void CMMFDevSoundClientImp::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings) sl@0: { sl@0: iDevSoundProxy->SetPrioritySettings(aPrioritySettings); sl@0: } sl@0: sl@0: sl@0: /* sl@0: * sl@0: * Returns the number of available pre-defined tone sequences. sl@0: * sl@0: * This is the number of fixed sequence supported by DevSound by default. sl@0: * sl@0: * @return "TInt" sl@0: * The fixed sequence count. This value is implementation dependent sl@0: * but is always greater than or equal to zero. sl@0: * sl@0: */ sl@0: inline TInt CMMFDevSoundClientImp::FixedSequenceCount() sl@0: { sl@0: sl@0: return iDevSoundProxy->FixedSequenceCount(); sl@0: } sl@0: sl@0: /* sl@0: * sl@0: * Returns the name assigned to a specific pre-defined tone sequence. sl@0: * sl@0: * This is the number of fixed sequence supported by DevSound by default. sl@0: * sl@0: * The function raises a panic if sequence number specified invalid. sl@0: * sl@0: * @return "TDesC&" sl@0: * A reference to a Descriptor containing the fixed sequence sl@0: * name indexed by aSequenceNumber. sl@0: * sl@0: * @param "TInt aSequenceNumber" sl@0: * The index identifying the specific pre-defined tone sequence. Index sl@0: * values are relative to zero. sl@0: * This can be any value from zero to the value returned by a call to sl@0: * CMdaAudioPlayerUtility::FixedSequenceCount() - 1. sl@0: * The function raises a panic if sequence number is not within this sl@0: * range. sl@0: * sl@0: */ sl@0: inline const TDesC& CMMFDevSoundClientImp::FixedSequenceName(TInt aSequenceNumber) sl@0: { sl@0: return iDevSoundProxy->FixedSequenceName(aSequenceNumber); sl@0: } sl@0: sl@0: sl@0: inline TInt CMMFDevSoundClientImp::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 CMMFDevSoundClientImp::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: