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: #include sl@0: sl@0: #include "mmfdevsoundadaptationbody.h" sl@0: #include "cdevaudiocontrol.h" sl@0: #include "cdevaudio.h" sl@0: #include "a3ffourcclookup.h" sl@0: sl@0: #include sl@0: sl@0: #include "mglobalproperties.h" sl@0: sl@0: const TInt KDefaultOnDTMFLength = 250000; sl@0: const TInt KDefaultOffDTMFLength = 50000; sl@0: const TInt KDefaultPauseDTMFLength = 250000; sl@0: const TInt KDefaultBufferSize = 4096; sl@0: sl@0: // ============================ MEMBER FUNCTIONS =============================// ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::CBody sl@0: // C++ default constructor can NOT contain any code, that sl@0: // might leave. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: CMMFDevSoundAdaptation::CBody::CBody(MDevSoundAdaptationObserver& aDevSoundObserver, sl@0: MGlobalProperties& aGlobalProperties) sl@0: :iDevSoundObserver(aDevSoundObserver) sl@0: { sl@0: TRACE_CREATE(); sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::CBody *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: sl@0: iGlobalProperties = &aGlobalProperties; sl@0: sl@0: iMode = EMMFStateIdle; sl@0: // Initialize default config for cases when the DevSound's client query using sl@0: // CMMDevSound::Config() before setting the configuration through sl@0: // CMMDevSound::SetConfigL(TMMFCappabilites aConfig) sl@0: iMmfConfig.iRate = EMMFSampleRate8000Hz; sl@0: iMmfConfig.iEncoding = EMMFSoundEncoding16BitPCM; sl@0: iMmfConfig.iChannels = EMMFMono; sl@0: iMmfConfig.iBufferSize = KDefaultBufferSize; sl@0: sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::ConstructL sl@0: // Symbian 2nd phase constructor can leave. sl@0: // assumes that iParent has already been set up properly sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::ConstructL(MGlobalProperties& aGlobalProperties) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::ConstructL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: sl@0: // create DevAudio sl@0: iDevAudio = CDevAudio::NewL(iDevSoundObserver, aGlobalProperties); sl@0: sl@0: //Default values for DTMF tones sl@0: iToneData.SetDtmfLengths(KDefaultOnDTMFLength,KDefaultOffDTMFLength,KDefaultPauseDTMFLength); sl@0: sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::NewL sl@0: // Two-phased constructor. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: CMMFDevSoundAdaptation::CBody* CMMFDevSoundAdaptation::CBody::NewL(MDevSoundAdaptationObserver& aDevSoundObserver, sl@0: MGlobalProperties& aGlobalProperties) sl@0: { sl@0: DP_STATIC_CONTEXT(CMMFDevSoundAdaptation::CBody::NewL *CD0*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: CMMFDevSoundAdaptation::CBody* self = new (ELeave) CBody(aDevSoundObserver, aGlobalProperties); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aGlobalProperties); sl@0: CleanupStack::Pop(self); sl@0: DP0_RET(self, "0x%x"); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::~CBody sl@0: // Destructor sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: CMMFDevSoundAdaptation::CBody::~CBody() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::~CBody *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: if(iDevAudio) sl@0: { sl@0: delete iDevAudio; sl@0: } sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // CMMFDevSoundAdaptation:CBody::PostOpenL() sl@0: // 2nd phase post open - used to setup internal attributes asynchronously sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::PostOpenL() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::PostOpenL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: User::LeaveIfError(iDevAudio->PostOpen()); sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::InitializeL sl@0: // Initializes CMMFDevSoundProxy object to play and record PCM16 raw audio data sl@0: // with sampling rate of 8 KHz. sl@0: // On completion of Initialization, calls InitializeComplete() on sl@0: // aDevSoundObserver. sl@0: // Leaves on failure. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::InitializeL(TMMFState aMode) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::InitializeL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: if (aMode == EMMFStateTonePlaying) sl@0: { sl@0: DoInitializeL(KUidFormatTone, aMode); sl@0: } sl@0: else sl@0: { sl@0: DoInitializeL(KUidFormatPCM16, aMode); sl@0: } sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::InitializeL 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: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::InitializeL(TUid /*aHWDev*/, sl@0: TMMFState /*aMode*/) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::InitializeL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: User::LeaveIfError(KErrNotSupported); sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::InitializeL sl@0: // Initializes DevSound object for the mode aMode for processing audio data sl@0: // with hardware device supporting FourCC aDesiredFourCC. sl@0: // On completion of Initialization, the observer will be notified via call back sl@0: // InitializeComplete(). sl@0: // Leaves on failure. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::InitializeL( sl@0: TFourCC aDesiredFourCC, sl@0: TMMFState aMode) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::InitializeL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: sl@0: TUid format = {0}; sl@0: TInt err = KErrNone; sl@0: sl@0: err = iGlobalProperties->GetFourCCConvertor().FourCCToFormat(aDesiredFourCC, format); sl@0: if(err == KErrNone) sl@0: { sl@0: DoInitializeL(format, aMode); sl@0: } sl@0: else sl@0: { sl@0: User::LeaveIfError(KErrNotSupported); sl@0: } sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::DoInitializeL sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::DoInitializeL( sl@0: TUid aFormat, sl@0: TMMFState aMode) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::DoInitializeL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP2_IN("format=0x%x, mode=%d",aFormat.iUid,aMode); sl@0: sl@0: sl@0: ASSERT(iDevAudio); sl@0: sl@0: TInt err(KErrNone); sl@0: sl@0: if ((aMode == EMMFStatePlaying) || (aMode == EMMFStateRecording) sl@0: || (aMode == EMMFStateTonePlaying)) sl@0: { sl@0: err = iDevAudio->Initialize(aFormat, aMode); sl@0: } sl@0: else sl@0: { sl@0: err = KErrNotSupported; sl@0: } sl@0: User::LeaveIfError(err); sl@0: sl@0: iMode = aMode; sl@0: sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::CancelInitialize sl@0: // Cancels the initialization of DevSound object sl@0: // returns an error code sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::CancelInitialize() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::CancelInitialize *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: TInt err=iDevAudio->CancelInitialize(); sl@0: DP0_RET(err, "%d"); sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::Capabilities sl@0: // Returns the supported Audio settings. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::Capabilities(TMMFCapabilities& aCap) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::Capabilities *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: // query real values, on error just return last known (default) values sl@0: TInt err = iDevAudio->GetAudioControl()->GetCapabilities(aCap); sl@0: DP0_RET(err, "%d"); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::Config() sl@0: // Returns the current audio settings. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TMMFCapabilities CMMFDevSoundAdaptation::CBody::Config() const sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::Config *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: // Query real values, on error just return last known (default) values sl@0: TMMFCapabilities config; sl@0: TInt err = iDevAudio->GetAudioControl()->GetConfig(config); sl@0: // TBD: for now, just return set value for encoding - codec does not give this sl@0: config.iEncoding = iMmfConfig.iEncoding; sl@0: if ( err == KErrNone ) sl@0: { sl@0: DP0_RET(config, "0"); sl@0: } sl@0: DP0_RET(iMmfConfig, "0"); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::SetConfigL sl@0: // Configure device for the settings in aConfig. sl@0: // Use this to set sampling rate, Encoding and Mono/Stereo. sl@0: // sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::SetConfigL(const TMMFCapabilities& aConfig) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::SetConfigL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP3_IN("rate 0x%x, channels 0x%x, encoding 0x%x", sl@0: aConfig.iRate, aConfig.iChannels, aConfig.iEncoding); sl@0: User::LeaveIfError(iDevAudio->GetAudioControl()->SetConfig(aConfig)); sl@0: // success, update local copy sl@0: iMmfConfig.iRate = aConfig.iRate; sl@0: iMmfConfig.iChannels = aConfig.iChannels; sl@0: iMmfConfig.iEncoding = aConfig.iEncoding; sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::MaxVolume sl@0: // Returns an integer representing the maximum volume. sl@0: // This is the maximum value which can be passed to CMMFDevSoundProxy::SetVolume sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::MaxVolume() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::MaxVolume *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: DP0_RET(iDevAudio->DevSoundMaxVolume(), "%d"); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::Volume sl@0: // Returns an integer representing the current volume. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::Volume() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::Volume *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: DP0_RET(iDevAudio->DevSoundVolume(), "%d"); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::SetVolume sl@0: // Changes the current playback volume to a specified value. sl@0: // The volume can be changed before or during playback and is effective sl@0: // immediately. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::SetVolume(TInt aVolume, TBool& aAsyncCompletion) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::SetVolume *CD1*, CtxDevSound, DPLOCAL); sl@0: DP1_IN("aVolume = %d", aVolume); sl@0: TInt error = iDevAudio->SetDevSoundVolume(aVolume, aAsyncCompletion); sl@0: DP0_RET(error, "%d"); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::MaxGain sl@0: // Returns an integer representing the maximum gain. sl@0: // This is the maximum value which can be passed to CMMFDevSoundProxy::SetGain. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::MaxGain() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::MaxGain *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: DP0_RET(iDevAudio->DevSoundMaxGain(), "%d"); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::Gain sl@0: // Returns an integer representing the current gain. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::Gain() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::Gain *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: DP0_RET(iDevAudio->DevSoundGain(), "%d"); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::SetGain sl@0: // Changes the current recording gain to a specified value. sl@0: // The gain can be changed before or during recording and is effective sl@0: // immediately. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::SetGain(TInt aGain, TBool& aAsyncCompletion) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::SetGain *CD1*, CtxDevSound, DPLOCAL); sl@0: DP1_IN("aGain = %d", aGain); sl@0: TInt error = iDevAudio->SetDevSoundGain(aGain, aAsyncCompletion); sl@0: DP0_RET(error, "%d"); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::GetPlayBalanceL sl@0: // Returns the speaker balance set for playing. sl@0: // Leaves on failure. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::GetPlayBalanceL(TInt& aLeftPercentage, sl@0: TInt& aRightPercentage) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::GetPlayBalanceL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: iDevAudio->GetDevSoundPlayBalance(aLeftPercentage, aRightPercentage); sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::SetPlayBalanceL sl@0: // Sets the speaker balance for playing. sl@0: // The speaker balance can be changed before or during playback and is sl@0: // effective immediately. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::SetPlayBalanceL(TInt aLeftPercentage, sl@0: TInt aRightPercentage, sl@0: TBool& aAsyncCompletion) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::SetPlayBalanceL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP2_IN("aLeftPercentage = %d, aRightPercentage=%d", aLeftPercentage, aRightPercentage); sl@0: sl@0: User::LeaveIfError(iDevAudio->SetDevSoundPlayBalance(aLeftPercentage, aRightPercentage, aAsyncCompletion)); sl@0: sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::GetRecordBalanceL sl@0: // Returns the microphone gain balance set for recording. sl@0: // Leaves on failure. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::GetRecordBalanceL(TInt& aLeftPercentage, sl@0: TInt& aRightPercentage) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::GetRecordBalanceL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: sl@0: iDevAudio->GetDevSoundRecordBalance(aLeftPercentage, aRightPercentage); sl@0: sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::SetRecordBalanceL sl@0: // Sets the microphone gain balance for recording. sl@0: // The microphone gain balance can be changed before or during recording and sl@0: // is effective immediately. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::SetRecordBalanceL(TInt aLeftPercentage, sl@0: TInt aRightPercentage, sl@0: TBool& aAsyncCompletion) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::SetRecordBalanceL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP2_IN("aLeftPercentage = %d, aRightPercentage=%d", aLeftPercentage, aRightPercentage); sl@0: sl@0: User::LeaveIfError(iDevAudio->SetDevSoundRecordBalance(aLeftPercentage, aRightPercentage,aAsyncCompletion)); sl@0: sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::PlayInitL 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: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::PlayInitL() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::PlayInitL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: sl@0: if(iMode==EMMFStatePlaying) sl@0: { sl@0: User::LeaveIfError(iDevAudio->GetAudioControl()->ProcessInit()); sl@0: } sl@0: else sl@0: { sl@0: DP1(DLERR,"Current mode is not EMMFStatePlaying! (iMode=%d)",iMode); sl@0: User::Leave(KErrNotReady); sl@0: } sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::RecordInitL 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: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::RecordInitL() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::RecordInitL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: if(iMode==EMMFStateRecording) sl@0: { sl@0: User::LeaveIfError(iDevAudio->GetAudioControl()->ProcessInit()); sl@0: } sl@0: else sl@0: { sl@0: DP1(DLERR,"Current mode is not EMMFStateRecording! (iMode=%d)",iMode); sl@0: User::Leave(KErrNotReady); sl@0: } sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::PlayData 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: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::PlayData() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::PlayData *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: sl@0: if(iMode==EMMFStatePlaying) sl@0: { sl@0: iDevAudio->GetAudioControl()->ProcessData(); sl@0: } sl@0: else sl@0: { sl@0: DP1(DLERR,"Current mode is not EMMFStatePlaying! (iMode=%d)",iMode); sl@0: } sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::RecordData 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: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::RecordData() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::RecordData *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: if(iMode==EMMFStateRecording) sl@0: { sl@0: iDevAudio->GetAudioControl()->ProcessData(); sl@0: } sl@0: else sl@0: { sl@0: DP1(DLERR,"Current mode is not EMMFStateRecording! (iMode=%d)",iMode); sl@0: } sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::Stop sl@0: // Stops the ongoing operation (Play, Record, TonePlay) sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TBool CMMFDevSoundAdaptation::CBody::Stop() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::Stop *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: TBool isCompleted = EFalse; sl@0: sl@0: // Need for sequences when calling stop and is already stopped sl@0: TDevSoundAdaptorState state = iDevAudio->ActiveState(); sl@0: if( (iMode != EMMFStateIdle) && sl@0: (state == EDevSoundAdaptorActive_Active || sl@0: state == EDevSoundAdaptorPaused_Primed ) ) sl@0: { sl@0: TInt err = iDevAudio->GetAudioControl()->Stop(); sl@0: if (err != KErrNone) sl@0: { sl@0: isCompleted = ETrue; sl@0: } sl@0: } sl@0: else sl@0: { sl@0: isCompleted = ETrue; sl@0: } sl@0: DP_OUT(); sl@0: return isCompleted; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::Pause sl@0: // Temporarily Stops the ongoing operation (Play, Record, TonePlay) sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::Pause() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::Pause *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: sl@0: TInt err = iDevAudio->GetAudioControl()->Pause(); sl@0: DP0_RET(err, "%d"); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::SamplesRecorded sl@0: // Returns the sample recorded so far. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::SamplesRecorded() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::SamplesRecorded *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: sl@0: if(iMode==EMMFStateRecording) sl@0: { sl@0: DP_OUT(); sl@0: return(iDevAudio->GetAudioControl()->GetSamples()); sl@0: } sl@0: else sl@0: { sl@0: DP1(DLERR,"Current mode is not EMMFStateRecording! (iMode=%d)",iMode); sl@0: DP0_RET(0, "%d"); sl@0: } sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::SamplesPlayed sl@0: // Returns the sample played so far. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::SamplesPlayed() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::SamplesPlayed *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: if(iMode==EMMFStatePlaying) sl@0: { sl@0: DP_OUT(); sl@0: return(iDevAudio->GetAudioControl()->GetSamples()); sl@0: } sl@0: else sl@0: { sl@0: DP1(DLERR,"Current mode is not EMMFStatePlaying! (iMode=%d)",iMode); sl@0: DP0_RET(0, "%d"); sl@0: } sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::PlayToneL sl@0: // Initializes audio device and start playing tone. Tone is played with sl@0: // frequency and for duration specified. sl@0: // Leaves on failure. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::PlayToneL( sl@0: TInt aFrequency, sl@0: const TTimeIntervalMicroSeconds& aDuration) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::PlayToneL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP1_IN("aFrequency = %d", aFrequency); sl@0: sl@0: if(iMode==EMMFStateTonePlaying) sl@0: { sl@0: iToneData.SetType(TToneData::ESimple); sl@0: iToneData.SetFrequencyOne(aFrequency); sl@0: iToneData.SetDuration(aDuration); sl@0: User::LeaveIfError(iDevAudio->GetAudioControl()->SetToneData(iToneData)); sl@0: User::LeaveIfError(iDevAudio->GetAudioControl()->ProcessInit()); sl@0: } sl@0: else sl@0: { sl@0: DP1(DLERR,"Current mode is not EMMFStateTonePlaying! (iMode=%d)",iMode); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::PlayDualToneL 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: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::PlayDualToneL( sl@0: TInt aFrequencyOne, sl@0: TInt aFrequencyTwo, sl@0: const TTimeIntervalMicroSeconds& aDuration) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::PlayDualToneL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP2_IN("aFrequencyOne = %d, aFrequencyTwo=%d", aFrequencyOne, aFrequencyTwo); sl@0: sl@0: if(iMode==EMMFStateTonePlaying) sl@0: { sl@0: iToneData.SetType(TToneData::EDual); sl@0: iToneData.SetFrequencyOne(aFrequencyOne); sl@0: iToneData.SetFrequencyTwo(aFrequencyTwo); sl@0: iToneData.SetDuration(aDuration); sl@0: User::LeaveIfError(iDevAudio->GetAudioControl()->SetToneData(iToneData)); sl@0: User::LeaveIfError(iDevAudio->GetAudioControl()->ProcessInit()); sl@0: } sl@0: else sl@0: { sl@0: DP1(DLERR,"Current mode is not EMMFStateTonePlaying! (iMode=%d)",iMode); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::PlayDTMFStringL sl@0: // Initializes audio device and start playing DTMF string aDTMFString. sl@0: // Leaves on failure. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::PlayDTMFStringL(const TDesC& aDTMFString) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::PlayDTMFStringL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: sl@0: if(iMode==EMMFStateTonePlaying) sl@0: { sl@0: iToneData.SetType(TToneData::EDtmfString); sl@0: iToneData.SetDTMFString(const_cast(aDTMFString)); sl@0: User::LeaveIfError(iDevAudio->GetAudioControl()->SetToneData(iToneData)); sl@0: User::LeaveIfError(iDevAudio->GetAudioControl()->ProcessInit()); sl@0: } sl@0: else sl@0: { sl@0: DP1(DLERR,"Current mode is not EMMFStateTonePlaying! (iMode=%d)",iMode); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::PlayToneSequenceL sl@0: // Initializes audio device and start playing tone sequence. sl@0: // sl@0: // Leaves on failure. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::PlayToneSequenceL(const TDesC8& aData) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::PlayToneSequenceL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: sl@0: if(iMode==EMMFStateTonePlaying) sl@0: { sl@0: iToneData.SetType(TToneData::ESequence); sl@0: iToneData.SetSequenceData(const_cast(aData)); sl@0: User::LeaveIfError(iDevAudio->GetAudioControl()->SetToneData(iToneData)); sl@0: User::LeaveIfError(iDevAudio->GetAudioControl()->ProcessInit()); sl@0: } sl@0: else sl@0: { sl@0: DP1(DLERR,"Current mode is not EMMFStateTonePlaying! (iMode=%d)",iMode); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::PlayFixedSequenceL sl@0: // Initializes audio device and start playing the specified pre-defined tone sl@0: // sequence. sl@0: // sl@0: // Leaves on failure. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::PlayFixedSequenceL(TInt /*aSequenceNumber*/) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::PlayFixedSequenceL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: User::Leave(KErrNotSupported); sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::SetToneRepeats sl@0: // Defines the number of times the audio is to be repeated during the tone sl@0: // playback operation. A period of silence can follow each playing of tone. sl@0: // The tone playing can be repeated indefinitely. sl@0: // Supported only during tone playing. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::SetToneRepeats( sl@0: TInt aRepeatCount, sl@0: const TTimeIntervalMicroSeconds& aRepeatTrailingSilence) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::SetToneRepeats *CD1*, CtxDevSound, DPLOCAL); sl@0: DP1_IN("aRepeatCount = %d", aRepeatCount); sl@0: sl@0: TInt err = KErrNone; sl@0: iToneData.SetRepeatCount(aRepeatCount); sl@0: iToneData.SetRepeatTrailingSilence(aRepeatTrailingSilence); sl@0: sl@0: DP0_RET(err, "%d"); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::SetDTMFLengths 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: // Supported only during tone playing. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::SetDTMFLengths( sl@0: TTimeIntervalMicroSeconds32& aToneOnLength, sl@0: TTimeIntervalMicroSeconds32& aToneOffLength, sl@0: TTimeIntervalMicroSeconds32& aPauseLength) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::SetDTMFLengths *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: sl@0: TInt err = KErrNone; sl@0: if (aToneOnLength.Int() < KMdaInfiniteDurationDTMFToneOnLength) sl@0: { sl@0: aToneOnLength = TTimeIntervalMicroSeconds32(0); sl@0: } sl@0: if (aToneOffLength.Int() < 0) sl@0: { sl@0: aToneOffLength = TTimeIntervalMicroSeconds32(0); sl@0: } sl@0: if (aPauseLength.Int() < 0) sl@0: { sl@0: aPauseLength = TTimeIntervalMicroSeconds32(0); sl@0: } sl@0: sl@0: iToneData.SetDtmfLengths(aToneOnLength, aToneOffLength, aPauseLength); sl@0: sl@0: DP0_RET(err, "%d"); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::SetVolumeRamp 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: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::SetVolumeRamp( sl@0: const TTimeIntervalMicroSeconds& aRampDuration) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::SetVolumeRamp *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: sl@0: TInt err = iDevAudio->SetVolumeRamp(aRampDuration); sl@0: DP0_RET(err, "%d"); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::SetPrioritySettings sl@0: // Defines the priority settings that should be used for this instance. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::SetPrioritySettings( sl@0: const TMMFPrioritySettings& aPrioritySettings) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::SetPrioritySettings *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: sl@0: TInt err = iDevAudio->SetPrioritySettings(aPrioritySettings); sl@0: if (err == KErrNone) sl@0: { sl@0: iPrioritySettings = aPrioritySettings; sl@0: } sl@0: DP0_RET(err, "%d"); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::CustomInterface sl@0: // @see sounddevice.h sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TAny* CMMFDevSoundAdaptation::CBody::CustomInterface(TUid aInterfaceId) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::CustomInterface *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: if ( iDevAudio ) sl@0: { sl@0: DP_OUT(); sl@0: return(iDevAudio->GetAudioControl()->CustomInterface(aInterfaceId)); sl@0: } sl@0: else sl@0: { sl@0: DP0_RET(NULL, "%d"); sl@0: } sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::FixedSequenceCount sl@0: // Returns the number of available pre-defined tone sequences. sl@0: // This is the number of fixed sequence supported by DevSound by default. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::FixedSequenceCount() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::FixedSequenceCount *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: DP0_RET(0, "%d"); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::FixedSequenceName sl@0: // Returns the name assigned to a specific pre-defined tone sequence. sl@0: // This is the number of fixed sequence supported by DevSound by default. sl@0: // The function raises a panic if sequence number specified invalid. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: const TDesC& CMMFDevSoundAdaptation::CBody::FixedSequenceName( sl@0: TInt /*aSequenceNumber*/) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::FixedSequenceName *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: DP0_RET(KNullDesC, ""); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::GetSupportedInputDataTypesL sl@0: // @see sounddevice.h sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::GetSupportedInputDataTypesL( sl@0: RArray& aSupportedDataTypes, sl@0: const TMMFPrioritySettings& /*aPrioritySettings*/) const sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::GetSupportedInputDataTypesL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: //aPrioritySettings not used on ref DevSound sl@0: //search for playing datatypes sl@0: iDevAudio->DevSoundSupportedDataTypesL(aSupportedDataTypes, KDataForPlay); sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::GetSupportedOutputDataTypesL sl@0: // @see sounddevice.h sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CMMFDevSoundAdaptation::CBody::GetSupportedOutputDataTypesL( sl@0: RArray& aSupportedDataTypes, sl@0: const TMMFPrioritySettings& /*aPrioritySettings*/) const sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::GetSupportedOutputDataTypesL *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: //aPrioritySettings not used on ref DevSound sl@0: // search for recording datatypes sl@0: iDevAudio->DevSoundSupportedDataTypesL(aSupportedDataTypes, KDataForRecord); sl@0: DP_OUT(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::SetClientConfig sl@0: // Sets client capabilities for this instance of DevSound Adaptation. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::SetClientConfig( sl@0: const TProcessId& aActualProcessId, sl@0: const TProcessId& aProcessId) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::SetClientConfig *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: sl@0: TInt err = iDevAudio->SetClientConfig(aActualProcessId, aProcessId); sl@0: DP0_RET(err, "%d"); sl@0: } sl@0: sl@0: TInt CMMFDevSoundAdaptation::CBody::SetClientConfig( sl@0: const TProcessId& aProcessId) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::SetClientConfig *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: sl@0: TInt err = iDevAudio->SetClientConfig(aProcessId); sl@0: DP0_RET(err, "%d"); sl@0: } sl@0: sl@0: TBool CMMFDevSoundAdaptation::CBody::CloseDevSound() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::CloseDevSound *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: DP_OUT(); sl@0: return iDevAudio->GetAudioControl()->DestroyChain(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::ProcessingFinishedReceived sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::ProcessingFinishedReceived(TBool& asyncOperation) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::ProcessingFinishedReceived *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: DP_OUT(); sl@0: return iDevAudio->GetAudioControl()->ProcessingFinishedReceived(asyncOperation); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::ProcessingFinishedReceived sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::ProcessingError(TBool& asyncOperation) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::ProcessingError *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: DP_OUT(); sl@0: return iDevAudio->GetAudioControl()->ProcessingError(asyncOperation); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::EmptyBuffers sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::EmptyBuffers() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::EmptyBuffers *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: TInt err(KErrNone); sl@0: // Empty buffers is only supported on playing sl@0: if (iMode == EMMFStateRecording || iMode == EMMFStateTonePlaying) sl@0: { sl@0: err = KErrNotSupported; sl@0: } sl@0: else if (!iDevAudio) sl@0: { sl@0: err = KErrNotReady; sl@0: } sl@0: else sl@0: { sl@0: TDevSoundAdaptorState state = iDevAudio->ActiveState(); sl@0: if (state == EDevSoundAdaptorActive_Active || sl@0: state == EDevSoundAdaptorPaused_Primed ) sl@0: { sl@0: err = iDevAudio->GetAudioControl()->RequestEmptyBuffers(); sl@0: } sl@0: else sl@0: { sl@0: err = KErrNotReady; sl@0: } sl@0: } sl@0: DP0_RET(err, "%d"); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::RegisterAsClient sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::RegisterAsClient *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: TInt err(KErrNone); sl@0: if (iDevAudio) sl@0: { sl@0: err = iDevAudio->RegisterAsClient(aEventType, aNotificationRegistrationData); sl@0: } sl@0: else sl@0: { sl@0: err = KErrNotReady; sl@0: } sl@0: DP0_RET(err, "%d"); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::CancelRegisterAsClient sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::CancelRegisterAsClient(TUid aEventType) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::CancelRegisterAsClient *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: TInt err(KErrNone); sl@0: if (iDevAudio) sl@0: { sl@0: err = iDevAudio->CancelRegisterAsClient(aEventType); sl@0: } sl@0: else sl@0: { sl@0: err = KErrNotReady; sl@0: } sl@0: DP0_RET(err, "%d"); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::GetResourceNotificationData sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::GetResourceNotificationData(TUid /*aEventType*/, TDes8& aNotificationData) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::GetResourceNotificationData *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: TInt err(KErrNone); sl@0: if (iDevAudio) sl@0: { sl@0: TMMFTimeIntervalMicroSecondsPckg pckg = TTimeIntervalMicroSeconds(SamplesPlayed()); sl@0: aNotificationData.Copy(pckg); sl@0: } sl@0: else sl@0: { sl@0: err = KErrNotReady; sl@0: } sl@0: DP0_RET(err, "%d"); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::WillResumePlay sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::WillResumePlay() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::WillResumePlay *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: TInt err(KErrNone); sl@0: if (iDevAudio) sl@0: { sl@0: err = iDevAudio->WillResumePlay(); sl@0: } sl@0: else sl@0: { sl@0: err = KErrNotReady; sl@0: } sl@0: DP0_RET(err, "%d"); sl@0: } sl@0: sl@0: // CMMFDevSoundAdaptation::CBody::GetTimePlayed sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::GetTimePlayed(TTimeIntervalMicroSeconds& aTime) sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::GetTimePlayed *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: sl@0: TInt err = iDevAudio->GetAudioControl()->GetTimePlayed(aTime); sl@0: DP0_RET(err, "%d"); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::IsResumeSupported sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TBool CMMFDevSoundAdaptation::CBody::IsResumeSupported() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::IsResumeSupported *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: TBool isSupported = iDevAudio->IsResumeSupported(); sl@0: DP0_RET(isSupported, "%d"); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CMMFDevSoundAdaptation::CBody::Resume sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt CMMFDevSoundAdaptation::CBody::Resume() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::Resume *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: TInt err = iDevAudio->GetAudioControl()->Resume(); sl@0: DP0_RET(err, "%d"); sl@0: } sl@0: sl@0: void CMMFDevSoundAdaptation::CBody::BufferErrorEvent() sl@0: { sl@0: ASSERT(iDevAudio); sl@0: iDevAudio->GetAudioControl()->BufferErrorEvent(); sl@0: } sl@0: sl@0: void CMMFDevSoundAdaptation::CBody::RollbackAdaptorActiveStateToBeforeCommit() sl@0: { sl@0: DP_CONTEXT(CMMFDevSoundAdaptation::CBody::RollbackAdaptorActiveStateToBeforeCommit *CD1*, CtxDevSound, DPLOCAL); sl@0: DP_IN(); sl@0: TDevSoundAdaptorState previousState = iDevAudio->PreviousState(); sl@0: // Set previous state to the active state set after state changing Commit call sl@0: iDevAudio->SetPreviousState(iDevAudio->ActiveState()); sl@0: // Set active state to the previous state set before state changing Commit call sl@0: iDevAudio->SetActiveState(previousState); sl@0: DP_OUT(); sl@0: }