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: // INCLUDE FILES sl@0: #include "mmfdevsoundproxy.h" sl@0: #ifdef _DEBUG sl@0: #include sl@0: sl@0: #define SYMBIAN_DEBPRN0(str) RDebug::Print(str, this) sl@0: #define SYMBIAN_DEBPRN1(str, val1) RDebug::Print(str, this, val1) sl@0: #define SYMBIAN_DEBPRN2(str, val1, val2) RDebug::Print(str, this, val1, val2) sl@0: #else sl@0: #define SYMBIAN_DEBPRN0(str) sl@0: #define SYMBIAN_DEBPRN1(str, val1) sl@0: #define SYMBIAN_DEBPRN2(str, val1, val2) sl@0: #endif //_DEBUG sl@0: sl@0: // SYMBIAN_CHECK used to add extra asserts when MACRO is added - helps debugging overall A3F sl@0: sl@0: #ifdef SYMBIAN_FULL_STATE_CHECK sl@0: #define SYMBIAN_CHECK(c,p) __ASSERT_ALWAYS(c,p) sl@0: #else sl@0: #define SYMBIAN_CHECK(c,p) sl@0: #endif sl@0: sl@0: const TInt KMaxMessageQueueItems = 8; sl@0: sl@0: const TMMFCapabilities KZeroCapabilities = sl@0: { sl@0: 0,0,0,0 // all zero's sl@0: }; sl@0: sl@0: // ============================ LOCAL FUNCTIONS ================================ sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // This function raises a panic sl@0: // sl@0: // @param aError sl@0: // one of the several panic codes that may be raised by this dll sl@0: // sl@0: // @panic EMMFDevSoundProxyPlayDataWithoutInitialize is raised when playdata sl@0: // is called without initialization sl@0: // @panic EMMFDevSoundProxyRecordDataWithoutInitialize is raised when sl@0: // recorddata is called without initialization sl@0: // sl@0: GLDEF_C void Panic(TMMFDevSoundProxyPanicCodes aPanicCode) sl@0: { sl@0: User::Panic(KMMFDevSoundProxyPanicCategory, aPanicCode); sl@0: } sl@0: sl@0: // ============================ MEMBER FUNCTIONS =============================== sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevsoundProxy::RMMFDevsoundProxy sl@0: // C++ default constructor can NOT contain any code, that sl@0: // might leave. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C RMMFDevSoundProxy::RMMFDevSoundProxy() : sl@0: iBuffer(NULL), sl@0: iSeqName(NULL), sl@0: iDestinationPckg(TMMFMessageDestination(KUidInterfaceMMFDevSound, sl@0: KMMFObjectHandleDevSound)), sl@0: iState(EIdle), sl@0: iAudioServerProxy(NULL), sl@0: iDevSoundObserver(NULL), sl@0: iMsgQueueHandler(NULL), sl@0: iCustIntPckg() sl@0: { sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::Close sl@0: // Close the server session sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::Close() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Close - Enter")); sl@0: if (iAudioServerProxy) sl@0: { sl@0: if (iAudioServerProxy->Handle() != NULL) sl@0: { sl@0: TMMFDevSoundProxySettings set; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: TInt err = SendReceive(EMMFDevSoundProxyClose, sl@0: iDestinationPckg, sl@0: pckg); sl@0: } sl@0: iAudioServerProxy->Close(); sl@0: delete iAudioServerProxy; sl@0: iAudioServerProxy = NULL; sl@0: } sl@0: RMmfSessionBase::Close(); sl@0: iState = EIdle; sl@0: if (iMsgQueueHandler) sl@0: { sl@0: iMsgQueueHandler->Cancel(); sl@0: delete iMsgQueueHandler; sl@0: iMsgQueueHandler = NULL; sl@0: } sl@0: iMsgQueue.Close(); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Close - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::Open sl@0: // Open a DevSound server session sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::Open() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Open - Enter")); sl@0: TInt err = iMsgQueue.CreateGlobal(KNullDesC, KMaxMessageQueueItems, EOwnerThread); sl@0: // global, accessible to all that have its handle sl@0: sl@0: if (err == KErrNone) sl@0: { sl@0: iAudioServerProxy = NULL; sl@0: iMsgQueueHandler = NULL; sl@0: iBuffer = NULL; sl@0: iAudioServerProxy = new RMMFAudioServerProxy(); sl@0: if (iAudioServerProxy == NULL) sl@0: { sl@0: err = KErrNoMemory; sl@0: } sl@0: } sl@0: if (err == KErrNone) sl@0: { sl@0: err = iAudioServerProxy->Open(); sl@0: } sl@0: if (err == KErrNone) sl@0: { sl@0: err = SetReturnedHandle(iAudioServerProxy->GetDevSoundSessionHandle()); sl@0: } sl@0: if (err) sl@0: { sl@0: Close(); sl@0: } sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::Open - Exit [%d]"), err); sl@0: return err; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::PostOpen sl@0: // Finish opening process sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::PostOpen() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PostOpen - Enter")); sl@0: TInt err = SendReceive(EMMFDevSoundProxyPostOpen, iDestinationPckg); sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::PostOpen - Exit [%d]"), err); sl@0: return err; sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::SetDevSoundInfo sl@0: // Launch DevSound that might have been waiting for audio policy. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::SetDevSoundInfo() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetDevSoundInfo - Enter")); sl@0: TInt err = SendReceive(EMMFAudioLaunchRequests); sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::SetDevSoundInfo - Exit [%d]"), err); sl@0: return err; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::InitializeL sl@0: // Initialize DevSound for a specific mode. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::InitializeL( sl@0: MDevSoundObserver& aDevSoundObserver, sl@0: TMMFState aMode, sl@0: MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::InitializeL - Enter")); sl@0: TInt err = KErrNone; sl@0: iDevSoundObserver = &aDevSoundObserver; sl@0: sl@0: if (!(iState==EIdle || iState==EInitialized)) sl@0: { sl@0: err = KErrNotReady; sl@0: } sl@0: else sl@0: { sl@0: TMMFDevSoundProxySettings set; sl@0: set.iMode = aMode; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: TIpcArgs args(&iDestinationPckg, &pckg, iMsgQueue); sl@0: err = RSessionBase::SendReceive(EMMFDevSoundProxyInitialize1, args); sl@0: if (err == KErrNone) sl@0: { sl@0: StartReceivingMsgQueueHandlerEventsL(aDevSoundCIObserver); sl@0: iState = EInitializing; sl@0: } sl@0: } sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::InitializeL - Exit [%d]"), err); sl@0: User::LeaveIfError(err); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::InitializeL sl@0: // Initialize DevSound with specific HwDevice id and mode. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::InitializeL( sl@0: MDevSoundObserver& /*aDevSoundObserver*/, sl@0: TUid /*aHWDev*/, sl@0: TMMFState /*aMode*/, sl@0: MMMFDevSoundCustomInterfaceObserver& /*aDevSoundCIObserver*/) sl@0: { sl@0: TInt err = KErrNotSupported; sl@0: User::LeaveIfError(err); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::InitializeL sl@0: // Initialize DevSound for the specific FourCC and mode. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::InitializeL( sl@0: MDevSoundObserver& aDevSoundObserver, sl@0: TFourCC aDesiredFourCC, sl@0: TMMFState aMode, sl@0: MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::InitializeL - Enter")); sl@0: TInt err = KErrNone; sl@0: if(aMode == EMMFStateTonePlaying) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: iDevSoundObserver = &aDevSoundObserver; sl@0: if (!(iState==EIdle || iState==EInitialized)) sl@0: { sl@0: err = KErrNotReady; sl@0: } sl@0: else sl@0: { sl@0: TMMFDevSoundProxySettings set; sl@0: set.iDesiredFourCC = aDesiredFourCC; sl@0: set.iMode = aMode; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: TIpcArgs args(&iDestinationPckg, &pckg, iMsgQueue); sl@0: err = RSessionBase::SendReceive(EMMFDevSoundProxyInitialize4, args); sl@0: if (err == KErrNone) sl@0: { sl@0: StartReceivingMsgQueueHandlerEventsL(aDevSoundCIObserver); sl@0: iState = EInitializing; sl@0: } sl@0: } sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::InitializeL - Exit [%d]"), err); sl@0: User::LeaveIfError(err); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::Capabilities sl@0: // Returns the capabilities of the DevSound server. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Capabilities() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Capabilities - Enter")); sl@0: // TODO should we use the following ? SYMBIAN_CHECK(iState>=EInitialized, Panic(EMMFDevSoundProxyCapabilitiesInWrongState)); sl@0: if (iState < EInitialized) sl@0: { sl@0: // call has been made before we are initialized. Not much we can do, so return sl@0: // dummy values but hit debugger on the emulator sl@0: __DEBUGGER() sl@0: RDebug::Print(_L("BRDBG:CapabilitiesCalledWhenNotInitialised")); // TODO Remove or redo as trace sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Capabilities - Exit")); sl@0: return KZeroCapabilities; sl@0: } sl@0: TMMFDevSoundProxySettings set; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: TInt err = SendReceiveResult(EMMFDevSoundProxyCapabilities, sl@0: iDestinationPckg, sl@0: KNullDesC8, sl@0: pckg); sl@0: if (err == KErrNone) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Capabilities - Exit")); sl@0: return pckg().iCaps; sl@0: } sl@0: else sl@0: { sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::Capabilities - Exit [%d]"), err); sl@0: return KZeroCapabilities; sl@0: } sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // TMMFCapabilities RMMFDevSoundProxy::Config sl@0: // Returns the current configuration of the DevSound. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Config() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Config - Enter")); sl@0: // TODO should we use the following ? SYMBIAN_CHECK(iState>=EInitialized, Panic(EMMFDevSoundProxyConfigInWrongState)); sl@0: if (iState < EInitialized) sl@0: { sl@0: // call has been made before we are initialized. Not much we can do, so return sl@0: // dummy values but hit debugger on the emulator sl@0: __DEBUGGER() sl@0: RDebug::Print(_L("BRDBG:ConfigCalledWhenNotInitialised")); // TODO Remove or redo as trace sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Config - Exit")); sl@0: return KZeroCapabilities; sl@0: } sl@0: TMMFDevSoundProxySettings set; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: SendReceiveResult(EMMFDevSoundProxyConfig, sl@0: iDestinationPckg, sl@0: KNullDesC8, sl@0: pckg); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Config - Exit")); sl@0: return pckg().iConfig; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::SetConfigL sl@0: // Configures the DevSound server. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::SetConfigL( sl@0: const TMMFCapabilities& aConfig ) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetConfigL - Enter")); sl@0: TInt err = KErrNone; sl@0: sl@0: if (iState==EInitialized) sl@0: { sl@0: TMMFDevSoundProxySettings set; sl@0: set.iConfig = aConfig; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: err = SendReceive(EMMFDevSoundProxySetConfig, sl@0: iDestinationPckg, sl@0: pckg); sl@0: } sl@0: else sl@0: { sl@0: RDebug::Print(_L("BRDBG:SetConfigCalledWhenNotInitialised")); // TODO Remove or redo as trace sl@0: err = KErrNotReady; sl@0: } sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::SetConfigL - Exit [%d]"), err); sl@0: User::LeaveIfError(err); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::MaxVolume sl@0: // Returns the maximum volume supported by DevSound server for playing back.. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::MaxVolume() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::MaxVolume - Enter")); sl@0: TMMFDevSoundProxySettings set; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: SendReceiveResult(EMMFDevSoundProxyMaxVolume, sl@0: iDestinationPckg, sl@0: KNullDesC8, sl@0: pckg); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::MaxVolume - Exit")); sl@0: return pckg().iMaxVolume; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::Volume sl@0: // Returns the current volume. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::Volume() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Volume - Enter")); sl@0: TMMFDevSoundProxySettings set; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: SendReceiveResult(EMMFDevSoundProxyVolume, sl@0: iDestinationPckg, sl@0: KNullDesC8, sl@0: pckg); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Volume - Exit")); sl@0: return pckg().iVolume; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::SetVolume sl@0: // Sets the current volume. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::SetVolume(TInt aVolume ) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetVolume - Enter")); sl@0: TMMFDevSoundProxySettings set; sl@0: set.iVolume = aVolume; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: TInt err = SendReceive(EMMFDevSoundProxySetVolume, sl@0: iDestinationPckg, sl@0: pckg); sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::SetVolume - Exit [%d]"), err); sl@0: return err; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::MaxGain sl@0: // Returns maximum gain supported by DevSound server for recording. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::MaxGain() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::MaxGain - Enter")); sl@0: TMMFDevSoundProxySettings set; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: SendReceiveResult(EMMFDevSoundProxyMaxGain, sl@0: iDestinationPckg, sl@0: KNullDesC8, sl@0: pckg); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::MaxGain - Exit")); sl@0: return pckg().iMaxGain; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::Gain sl@0: // Returns the current gain. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::Gain() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Gain - Enter")); sl@0: TMMFDevSoundProxySettings set; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: SendReceiveResult(EMMFDevSoundProxyGain, sl@0: iDestinationPckg, sl@0: KNullDesC8, sl@0: pckg); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Gain - Exit")); sl@0: return pckg().iGain; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::SetGain sl@0: // Sets the current gain. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::SetGain( sl@0: TInt aGain ) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetGain - Enter")); sl@0: TMMFDevSoundProxySettings set; sl@0: set.iGain = aGain; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: sl@0: TInt err = SendReceive(EMMFDevSoundProxySetGain, sl@0: iDestinationPckg, sl@0: pckg); sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::SetGain - Exit [%d]"), err); sl@0: return err; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::GetPlayBalanceL sl@0: // Returns play balance. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::GetPlayBalanceL( sl@0: TInt& aLeftPercentage, sl@0: TInt& aRightPercentage ) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetPlayBalanceL - Enter")); sl@0: TMMFDevSoundProxySettings set; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyPlayBalance, sl@0: iDestinationPckg, sl@0: KNullDesC8, sl@0: pckg)); sl@0: aLeftPercentage = pckg().iLeftPercentage; sl@0: aRightPercentage = pckg().iRightPercentage; sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetPlayBalanceL - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::SetPlayBalanceL sl@0: // Sets playbalance. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::SetPlayBalanceL( sl@0: TInt aLeftPercentage, sl@0: TInt aRightPercentage ) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetPlayBalanceL - Enter")); sl@0: TMMFDevSoundProxySettings set; sl@0: set.iLeftPercentage = aLeftPercentage; sl@0: set.iRightPercentage = aRightPercentage; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: User::LeaveIfError(SendReceive(EMMFDevSoundProxySetPlayBalance, sl@0: iDestinationPckg, sl@0: pckg)); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetPlayBalanceL - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::GetRecordBalanceL sl@0: // Returns record balance. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::GetRecordBalanceL( sl@0: TInt& aLeftPercentage, sl@0: TInt& aRightPercentage ) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetRecordBalanceL - Enter")); sl@0: TMMFDevSoundProxySettings set; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyRecordBalance, sl@0: iDestinationPckg, sl@0: KNullDesC8, sl@0: pckg)); sl@0: aLeftPercentage = pckg().iLeftPercentage; sl@0: aRightPercentage = pckg().iRightPercentage; sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetRecordBalanceL - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::SetRecordBalanceL sl@0: // Sets record balance. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::SetRecordBalanceL( sl@0: TInt aLeftPercentage, sl@0: TInt aRightPercentage ) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetRecordBalanceL - Enter")); sl@0: TMMFDevSoundProxySettings set; sl@0: set.iLeftPercentage = aLeftPercentage; sl@0: set.iRightPercentage = aRightPercentage; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: User::LeaveIfError(SendReceive(EMMFDevSoundProxySetRecordBalance, sl@0: iDestinationPckg, sl@0: pckg)); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetRecordBalanceL - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::PlayInitL sl@0: // Initilaizes DevSound to play digital audio and starts the play process. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::PlayInitL() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayInitL - Enter")); sl@0: if (!iDevSoundObserver || iState!=EInitialized) sl@0: { sl@0: if (iState == EPlaying || iState == EPlayingBufferWait) sl@0: { sl@0: // treat PlayInitL() during play as Resume() sl@0: User::LeaveIfError(Resume()); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayInitL - Exit")); sl@0: return; sl@0: } sl@0: User::Leave(KErrNotReady); sl@0: } sl@0: sl@0: User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayInit, sl@0: iDestinationPckg)); sl@0: iState = EPlaying; sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayInitL - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::RecordInitL sl@0: // Initilaizes DevSound to record digital audio and starts the record process. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::RecordInitL() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RecordInitL - Enter")); sl@0: if (!iDevSoundObserver || iState!=EInitialized) sl@0: { sl@0: if(iState == ERecording || iState == ERecordingBufferWait || iState == ERecordingInLastBufferCycle sl@0: || iState == ERecordingResumingInLastBufferCycle) sl@0: { sl@0: // treat RecordInitL() during record as Resume() sl@0: User::LeaveIfError(Resume()); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RecordInitL - Exit")); sl@0: return; sl@0: } sl@0: User::Leave(KErrNotReady); sl@0: } sl@0: sl@0: User::LeaveIfError(SendReceive(EMMFDevSoundProxyRecordInit, sl@0: iDestinationPckg)); sl@0: iState = ERecording; sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RecordInitL - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::PlayData sl@0: // Plays the data in the buffer at the current volume. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::PlayData() sl@0: { sl@0: //SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayData - Enter")); //Uncommenting this will produce a lot of logging! sl@0: __ASSERT_ALWAYS(iState == EPlaying || iState == EPlayingBufferWait, sl@0: Panic(EMMFDevSoundProxyPlayDataWithoutInitialize)); sl@0: ASSERT(iDevSoundObserver); sl@0: SYMBIAN_CHECK( iState == EPlayingBufferWait, sl@0: Panic(EMMFDevSoundProxyPlayDataInWrongState)); sl@0: TMMFDevSoundProxyHwBuf set; sl@0: set.iLastBuffer = iBuffer->LastBuffer(); sl@0: set.iBufferSize = iBuffer->Data().Size(); sl@0: TMMFDevSoundProxyHwBufPckg pckg(set); sl@0: sl@0: SendReceive(EMMFDevSoundProxyPlayData, iDestinationPckg, pckg); sl@0: iState = EPlaying; sl@0: //SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayData - Exit")); //Uncommenting this will produce a lot of logging! sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::RecordData sl@0: // Signals the device to continue recording. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::RecordData() sl@0: { sl@0: //SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RecordData - Enter")); //Uncommenting this will produce a lot of logging! sl@0: __ASSERT_ALWAYS(iState == ERecording || iState == ERecordingBufferWait || sl@0: iState == ERecordingInLastBufferCycle || iState == ERecordingResumingInLastBufferCycle, sl@0: Panic(EMMFDevSoundProxyRecordDataWithoutInitialize)); sl@0: ASSERT(iDevSoundObserver); sl@0: SYMBIAN_CHECK(iState == ERecordingBufferWait || iState == ERecordingInLastBufferCycle || sl@0: iState == ERecordingResumingInLastBufferCycle, sl@0: Panic(EMMFDevSoundProxyPlayDataInWrongState)); sl@0: switch (iState) sl@0: { sl@0: case ERecordingBufferWait: sl@0: // standard case sl@0: SendReceive(EMMFDevSoundProxyRecordData, iDestinationPckg); sl@0: iState = ERecording; sl@0: break; sl@0: case ERecordingInLastBufferCycle: sl@0: // ack of the last buffer. Just swallow - the server should not be sent an ack sl@0: iState = ERecording; sl@0: break; sl@0: case ERecordingResumingInLastBufferCycle: sl@0: // this is a RecordData() following a Resume() in the last cycle. This is where we do the resume! sl@0: SendReceive(EMMFDevSoundProxyResume, iDestinationPckg); // note ignore any error sl@0: iState = ERecording; sl@0: break; sl@0: } sl@0: //SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RecordData - Exit")); //Uncommenting this will produce a lot of logging! sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::Stop sl@0: // Stops the ongoing opeartion. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::Stop() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Stop - Enter")); sl@0: if (iState > EInitialized) sl@0: { sl@0: SendReceive(EMMFDevSoundProxyStop, iDestinationPckg); sl@0: iState = EInitialized; sl@0: iMsgQueueHandler->Finish(); // will delete the buffer sl@0: } sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Stop - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::Pause sl@0: // Temporarily stops the ongoing operation. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::Pause() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Pause - Enter")); sl@0: if(iState > EInitialized) sl@0: { sl@0: SendReceive(EMMFDevSoundProxyPause, iDestinationPckg); sl@0: } sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Pause - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::PlayToneL sl@0: // Plays the simple tone. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::PlayToneL( sl@0: TInt aFrequency, sl@0: const TTimeIntervalMicroSeconds& aDuration) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneL - Enter")); sl@0: if(iState==ETonePlaying) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneL - Exit")); sl@0: return; sl@0: } sl@0: sl@0: if (!iDevSoundObserver || iState!=EInitialized) sl@0: { sl@0: User::Leave(KErrNotReady); sl@0: } sl@0: sl@0: TMMFDevSoundProxySettings set; sl@0: set.iFrequencyOne = aFrequency; sl@0: set.iDuration = aDuration; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayTone, sl@0: iDestinationPckg, sl@0: pckg)); sl@0: iState = ETonePlaying; sl@0: iToneMode = ESimple; sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneL - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::PlayDualToneL sl@0: // Plays the dual tone. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::PlayDualToneL( sl@0: TInt aFrequencyOne, sl@0: TInt aFrequencyTwo, sl@0: const TTimeIntervalMicroSeconds& aDuration) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDualToneL - Enter")); sl@0: if(iState==ETonePlaying) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDualToneL - Exit")); sl@0: return; sl@0: } sl@0: sl@0: if (!iDevSoundObserver || iState!=EInitialized) sl@0: { sl@0: User::Leave(KErrNotReady); sl@0: } sl@0: sl@0: TMMFDevSoundProxySettings set; sl@0: set.iFrequencyOne = aFrequencyOne; sl@0: set.iFrequencyTwo = aFrequencyTwo; sl@0: set.iDuration = aDuration; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayDualTone, iDestinationPckg, pckg)); sl@0: iState = ETonePlaying; sl@0: iToneMode = EDual; sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDualToneL - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::PlayDTMFStringL sl@0: // Plays the DTMF string. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::PlayDTMFStringL(const TDesC& aDTMFString) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDTMFStringL - Enter")); sl@0: if(iState==ETonePlaying) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDTMFStringL - Exit")); sl@0: return; sl@0: } sl@0: sl@0: if (!iDevSoundObserver || iState!=EInitialized) sl@0: { sl@0: User::Leave(KErrNotReady); sl@0: } sl@0: sl@0: TPtr tempPtr(0,0); sl@0: tempPtr.Set(CONST_CAST(TUint16*, aDTMFString.Ptr()), sl@0: aDTMFString.Length(), sl@0: aDTMFString.Length()); sl@0: sl@0: User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyPlayDTMFString, sl@0: iDestinationPckg, sl@0: KNullDesC8, sl@0: tempPtr)); sl@0: iState = ETonePlaying; sl@0: iToneMode = EDTMFString; sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayDTMFStringL - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::PlayToneSequenceL sl@0: // Plays the tone sequence. (NRT/RNG) sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::PlayToneSequenceL(const TDesC8& aData ) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneSequenceL - Enter")); sl@0: if(iState==ETonePlaying) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneSequenceL - Exit")); sl@0: return; sl@0: } sl@0: sl@0: if (!iDevSoundObserver || iState!=EInitialized) sl@0: { sl@0: User::Leave(KErrNotReady); sl@0: } sl@0: sl@0: User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayToneSequence, sl@0: iDestinationPckg, sl@0: aData)); sl@0: iState = ETonePlaying; sl@0: iToneMode = ESequence; sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayToneSequenceL - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::PlayFixedSequenceL sl@0: // Plays the fixed sequence. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::PlayFixedSequenceL(TInt aSequenceNumber) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayFixedSequenceL - Enter")); sl@0: if(iState==ETonePlaying) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayFixedSequenceL - Exit")); sl@0: return; sl@0: } sl@0: sl@0: if (!iDevSoundObserver || iState!=EInitialized) sl@0: { sl@0: User::Leave(KErrNotReady); sl@0: } sl@0: sl@0: TPckgBuf seqNum(aSequenceNumber); sl@0: User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayFixedSequence, iDestinationPckg, seqNum)); sl@0: iState = ETonePlaying; sl@0: iToneMode = EFixedSequence; sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::PlayFixedSequenceL - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::SetDTMFLengths sl@0: // Set attributes for playing DTMF String. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::SetDTMFLengths( sl@0: TTimeIntervalMicroSeconds32& aToneOnLength, sl@0: TTimeIntervalMicroSeconds32& aToneOffLength, sl@0: TTimeIntervalMicroSeconds32& aPauseLength ) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetDTMFLengths - Enter")); sl@0: TMMFDevSoundProxySettings set; sl@0: set.iToneOnLength = aToneOnLength; sl@0: set.iToneOffLength = aToneOffLength; sl@0: set.iPauseLength = aPauseLength; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: SendReceive(EMMFDevSoundProxySetDTMFLengths, iDestinationPckg, pckg); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetDTMFLengths - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::SetVolumeRamp sl@0: // Sets the volume ramp duration. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::SetVolumeRamp( sl@0: const TTimeIntervalMicroSeconds& aRampDuration) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetVolumeRamp - Enter")); sl@0: TMMFDevSoundProxySettings set; sl@0: set.iDuration = aRampDuration; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: SendReceive(EMMFDevSoundProxySetVolumeRamp, iDestinationPckg, pckg); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetVolumeRamp - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::GetSupportedInputDataTypesL sl@0: // Returns supported datatypes for playing audio. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::GetSupportedInputDataTypesL( sl@0: RArray& aSupportedDataTypes, sl@0: const TMMFPrioritySettings& aPrioritySettings) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedInputDataTypesL - Enter")); sl@0: aSupportedDataTypes.Reset(); sl@0: sl@0: TMMFPrioritySettings prioritySet = aPrioritySettings; sl@0: TMMFPrioritySettingsPckg pckg(prioritySet); sl@0: sl@0: TPckgBuf numberOfElementsPckg; sl@0: User::LeaveIfError(SendReceiveResult( sl@0: EMMFDevSoundProxyGetSupportedInputDataTypes, sl@0: iDestinationPckg, sl@0: pckg, sl@0: numberOfElementsPckg)); sl@0: sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedInputDataTypesL - Exit 1")); sl@0: sl@0: HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC)); sl@0: TPtr8 ptr = buf->Des(); sl@0: sl@0: sl@0: User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyCopyFourCCArrayData, sl@0: iDestinationPckg, sl@0: KNullDesC8, sl@0: ptr)); sl@0: sl@0: RDesReadStream stream(ptr); sl@0: CleanupClosePushL(stream); sl@0: sl@0: sl@0: TInt count = numberOfElementsPckg(); sl@0: for (TInt i = 0; i < count; i++) sl@0: { sl@0: TInt err = aSupportedDataTypes.Append(stream.ReadInt32L()); sl@0: if (err) sl@0: {//note we don't destroy array because we don't own it sl@0: //but we do reset it as it is incomplete sl@0: aSupportedDataTypes.Reset(); sl@0: User::Leave(err); sl@0: } sl@0: } sl@0: CleanupStack::PopAndDestroy(&stream); sl@0: CleanupStack::PopAndDestroy(buf); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedInputDataTypesL - Exit 2")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::GetSupportedOutputDataTypesL sl@0: // Returns supported datatypes for recording audio. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::GetSupportedOutputDataTypesL( sl@0: RArray& aSupportedDataTypes, sl@0: const TMMFPrioritySettings& aPrioritySettings) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedOutputDataTypesL - Enter")); sl@0: aSupportedDataTypes.Reset(); sl@0: sl@0: TMMFPrioritySettings prioritySet = aPrioritySettings; sl@0: TMMFPrioritySettingsPckg pckg(prioritySet); sl@0: sl@0: TPckgBuf numberOfElementsPckg; sl@0: User::LeaveIfError(SendReceiveResult( sl@0: EMMFDevSoundProxyGetSupportedOutputDataTypes, sl@0: iDestinationPckg, sl@0: pckg, sl@0: numberOfElementsPckg)); sl@0: sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedOutputDataTypesL - Exit 1")); sl@0: sl@0: HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC)); sl@0: TPtr8 ptr = buf->Des(); sl@0: sl@0: sl@0: User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyCopyFourCCArrayData, sl@0: iDestinationPckg, sl@0: KNullDesC8, sl@0: ptr)); sl@0: RDesReadStream stream(ptr); sl@0: CleanupClosePushL(stream); sl@0: sl@0: sl@0: TInt count = numberOfElementsPckg(); sl@0: for (TInt i = 0; i < count; i++) sl@0: { sl@0: TInt err = aSupportedDataTypes.Append(stream.ReadInt32L()); sl@0: if (err) sl@0: {//note we don't destroy array because we don't own it sl@0: //but we do reset it as it is incomplete sl@0: aSupportedDataTypes.Reset(); sl@0: User::Leave(err); sl@0: } sl@0: } sl@0: CleanupStack::PopAndDestroy(&stream); sl@0: CleanupStack::PopAndDestroy(buf); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetSupportedOutputDataTypesL - Exit 2")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::SamplesRecorded sl@0: // Returns samples recorded so far. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::SamplesRecorded() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SamplesRecorded - Enter")); sl@0: TPckgBuf numSamples; sl@0: SendReceiveResult(EMMFDevSoundProxySamplesRecorded, sl@0: iDestinationPckg, sl@0: KNullDesC8, sl@0: numSamples); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SamplesRecorded - Exit")); sl@0: return numSamples(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::SamplesPlayed sl@0: // Returns samples played so far. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::SamplesPlayed() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SamplesPlayed - Enter")); sl@0: TPckgBuf numSamples; sl@0: SendReceiveResult(EMMFDevSoundProxySamplesPlayed, sl@0: iDestinationPckg, sl@0: KNullDesC8, sl@0: numSamples); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SamplesPlayed - Exit")); sl@0: return numSamples(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::SetToneRepeats sl@0: // Sets tone repeats sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::SetToneRepeats( sl@0: TInt aRepeatCount, sl@0: const TTimeIntervalMicroSeconds& sl@0: aRepeatTrailingSilence) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetToneRepeats - Enter")); sl@0: TPckgBuf countRepeat(aRepeatCount); sl@0: TPckgBuf repeatTS(aRepeatTrailingSilence); sl@0: SendReceive(EMMFDevSoundProxySetToneRepeats, sl@0: iDestinationPckg, sl@0: countRepeat, sl@0: repeatTS); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetToneRepeats - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::SetPrioritySettings sl@0: // Sets priority settings sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::SetPrioritySettings( sl@0: const TMMFPrioritySettings& aPrioritySettings) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetPrioritySettings - Enter")); sl@0: TPckgBuf prioritySet(aPrioritySettings); sl@0: SendReceive(EMMFDevSoundProxySetPrioritySettings, sl@0: iDestinationPckg, sl@0: prioritySet); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetPrioritySettings - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::FixedSequenceName sl@0: // Returns the name of fixed sequence for a given sequence number. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C const TDesC& RMMFDevSoundProxy::FixedSequenceName(TInt /*aSequenceNumber*/) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::FixedSequenceName - Enter")); sl@0: _LIT(KNullDesC, ""); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::FixedSequenceName - Exit")); sl@0: return KNullDesC; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::CustomInterface sl@0: // Returns a pointer to CustomInterface object. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TAny* RMMFDevSoundProxy::CustomInterface(TUid aInterfaceId) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomInterface - Enter")); sl@0: TMMFDevSoundProxySettings set; sl@0: set.iInterface = aInterfaceId; sl@0: // Added for ask for custom interface sl@0: TAny* customInterface = NULL; sl@0: if (aInterfaceId == KMmfUidDevSoundCancelInitializeCustomInterface) sl@0: { sl@0: MMMFDevSoundCancelInitialize* result = this; sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomInterface - Exit")); sl@0: return result; sl@0: } sl@0: TPckgBuf pckg2(customInterface); sl@0: sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: SendReceiveResult(EMMFDevSoundProxyCustomInterface, sl@0: iDestinationPckg, sl@0: pckg, pckg2); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomInterface - Exit")); sl@0: return reinterpret_cast (customInterface); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::FixedSequenceCount sl@0: // Returns the number of fixed sequences supported by DevSound. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::FixedSequenceCount() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::FixedSequenceCount - Enter")); sl@0: TPckgBuf fixSeqCountPckg; sl@0: SendReceiveResult(EMMFDevSoundProxyFixedSequenceCount, sl@0: iDestinationPckg, sl@0: KNullDesC8, sl@0: fixSeqCountPckg); sl@0: sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::FixedSequenceCount - Exit")); sl@0: return fixSeqCountPckg(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::BufferToBeFilledData sl@0: // Returns data buffer for playback. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::BufferToBeFilledData( sl@0: TBool aRequestChunk, TMMFDevSoundProxyHwBufPckg& aSetPckg) sl@0: { sl@0: //SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::BufferToBeFilledData - Enter")); //Uncommenting this will produce a lot of logging! sl@0: // Note that there will only ever be one of these requests outstanding sl@0: // per session sl@0: TPckgBuf requestChunkBuf (aRequestChunk); sl@0: TInt err = SendReceiveResult(EMMFDevSoundProxyBTBFData, sl@0: iDestinationPckg, sl@0: requestChunkBuf, sl@0: aSetPckg); sl@0: //SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::BufferToBeFilledData - Exit [%d]"), err); //Uncommenting this will produce a lot of logging! sl@0: return err; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::BufferToBeEmptiedData sl@0: // Returns data buffer for recording. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::BufferToBeEmptiedData( sl@0: TMMFDevSoundProxyHwBufPckg& aSetPckg) sl@0: { sl@0: //SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::BufferToBeEmptiedData - Enter")); //Uncommenting this will produce a lot of logging! sl@0: // Note that there will only ever be one of these requests outstanding sl@0: // per session sl@0: TInt err = SendReceiveResult(EMMFDevSoundProxyBTBEData, sl@0: iDestinationPckg, sl@0: KNullDesC8, sl@0: aSetPckg); sl@0: //SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::BufferToBeEmptiedData - Exit [%d]"), err); //Uncommenting this will produce a lot of logging! sl@0: return err; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::RegisterAsClient sl@0: // Registers the client for notification of resource avalibility. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::RegisterAsClient - Enter")); sl@0: TMMFDevSoundProxySettings set; sl@0: set.iNotificationEventUid = aEventType; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: TInt err = SendReceive(EMMFDevSoundProxyRequestResourceNotification, iDestinationPckg, pckg, aNotificationRegistrationData); sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::RegisterAsClient - Exit [%d]"), err); sl@0: return err; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::CancelRegisterAsClient sl@0: // Cancels the Registered Notification. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::CancelRegisterAsClient(TUid aEventType) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CancelRegisterAsClient - Enter")); sl@0: TMMFDevSoundProxySettings set; sl@0: set.iNotificationEventUid = aEventType; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: TInt err = SendReceiveResult(EMMFDevSoundProxyCancelRequestResourceNotification, iDestinationPckg, KNullDesC8, pckg); sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::CancelRegisterAsClient - Exit [%d]"), err); sl@0: return err; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::GetResourceNotificationData sl@0: // Returns the Notification data which the client needs to resume playing. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetResourceNotificationData - Enter")); sl@0: TMMFDevSoundProxySettings set; sl@0: set.iNotificationEventUid = aEventType; sl@0: TMMFDevSoundProxySettingsPckg pckg(set); sl@0: TInt err = SendReceiveResult(EMMFDevSoundProxyGetResourceNotificationData, iDestinationPckg, pckg, aNotificationData); sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::GetResourceNotificationData - Exit [%d]"), err); sl@0: return err; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::WillResumePlay sl@0: // Wait for the clients to resume play back even after the default timeout sl@0: // expires. Unless the client cancels the notification request or completes sl@0: // no other client gets notification. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::WillResumePlay() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::WillResumePlay - Enter")); sl@0: TInt err = SendReceive(EMMFDevSoundProxyWillResumePlay, iDestinationPckg); sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::WillResumePlay - Exit [%d]"), err); sl@0: return err; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::EmptyBuffers sl@0: // Empties the play buffers below DevSound without causing the codec sl@0: // to be deleted. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: sl@0: EXPORT_C TInt RMMFDevSoundProxy::EmptyBuffers() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::EmptyBuffers - Enter")); sl@0: TInt error = SendReceive(EMMFDevSoundProxyEmptyBuffers, iDestinationPckg); sl@0: sl@0: if(error==KErrNone) sl@0: { sl@0: if (iState==EPlayingBufferWait) sl@0: { sl@0: // Empty buffers terminates the buffer cycle sl@0: iState = EPlaying; sl@0: } sl@0: } sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::EmptyBuffers - Exit [%d]"), error); sl@0: return error; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::CancelInitialize sl@0: // Cancels the initialization process sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::CancelInitialize() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CancelInitialize - Enter")); sl@0: TInt err=KErrNone; sl@0: sl@0: if (iState==EInitializing) sl@0: { sl@0: err = SendReceive(EMMFDevSoundProxyCancelInitialize, iDestinationPckg); sl@0: iState = EIdle; sl@0: } sl@0: else sl@0: { sl@0: err = KErrNotReady; sl@0: } sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::CancelInitialize - Exit [%d]"), err); sl@0: return err; sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::SetClientThreadInfo sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::SetClientThreadInfo(TThreadId& aTid) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SetClientThreadInfo - Enter")); sl@0: TPckgBuf threadId(aTid); sl@0: TInt err = SendReceive(EMMFDevSoundProxySetClientThreadInfo, iDestinationPckg, threadId); sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::SetClientThreadInfo - Exit [%d]"), err); sl@0: return err; sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::CustomCommandSync() sl@0: // Send Message synchronously to DevSound server and return the result to client sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::CustomCommandSync( sl@0: const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandSync - Enter")); sl@0: TInt err = SendReceiveResult(aFunction, sl@0: aDestination, sl@0: aDataTo1, sl@0: aDataTo2, sl@0: aDataFrom); sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::CustomCommandSync - Exit [%d]"), err); sl@0: return err; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::RMMFDevSoundProxy() sl@0: // Send Message synchronously to DevSound server and return the result to client sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RMMFDevSoundProxy::CustomCommandSync( sl@0: const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandSync - Enter")); sl@0: TInt err = SendReceive(aFunction, aDestination, aDataTo1, aDataTo2); sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::CustomCommandSync - Exit [%d]"), err); sl@0: return err; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::RMMFDevSoundProxy() sl@0: // Send Message asynchronously to DevSound server sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::CustomCommandAsync( sl@0: const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom, sl@0: TRequestStatus& aStatus ) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandAsync - Enter")); sl@0: SendReceiveResult(aFunction, sl@0: aDestination, sl@0: aDataTo1, sl@0: aDataTo2, sl@0: aDataFrom, sl@0: aStatus); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandAsync - Exit")); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::RMMFDevSoundProxy() sl@0: // Send Message asynchronously to DevSound server sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RMMFDevSoundProxy::CustomCommandAsync( sl@0: const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TRequestStatus& aStatus ) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandAsync - Enter")); sl@0: SendReceive(aFunction, aDestination, aDataTo1, aDataTo2, aStatus); sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::CustomCommandAsync - Exit")); sl@0: } sl@0: sl@0: // implementation of a simple CustomCommand() scheme sl@0: EXPORT_C TInt RMMFDevSoundProxy::SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SyncCustomCommand - Enter")); sl@0: TMMFMessageDestinationPckg dest(TMMFMessageDestination(aUid, KMMFObjectHandleDevSound)); sl@0: sl@0: TInt err = KErrNone; sl@0: if (aOutParam==NULL) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SyncCustomCommand - Exit")); sl@0: err = SendReceive(EMMFDevSoundProxySyncCustomCommand, dest, aParam1, aParam2); sl@0: return err; sl@0: } sl@0: else sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::SyncCustomCommand - Exit")); sl@0: err = SendReceiveResult(EMMFDevSoundProxySyncCustomCommandResult, dest, aParam1, aParam2, *aOutParam); sl@0: return err; sl@0: } sl@0: } sl@0: sl@0: EXPORT_C void RMMFDevSoundProxy::AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::AsyncCustomCommand - Enter")); sl@0: TMMFMessageDestination dest(aUid, KMMFObjectHandleDevSound); sl@0: iCustIntPckg = dest; sl@0: if (aOutParam==NULL) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::AsyncCustomCommand - Exit")); sl@0: SendReceive(EMMFDevSoundProxyAsyncCustomCommand, iCustIntPckg, aParam1, aParam2, aStatus); sl@0: } sl@0: else sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::AsyncCustomCommand - Exit")); sl@0: SendReceiveResult(EMMFDevSoundProxyAsyncCustomCommandResult, iCustIntPckg, aParam1, aParam2, *aOutParam, aStatus); sl@0: } sl@0: } sl@0: sl@0: EXPORT_C TInt RMMFDevSoundProxy::GetTimePlayed(TTimeIntervalMicroSeconds& aTime) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::GetTimePlayed - Enter")); sl@0: TTimeIntervalMicroSeconds time(0); sl@0: TPckgBuf timePckg(time); sl@0: TInt err = SendReceiveResult(EMMFDevSoundProxyGetTimePlayed, iDestinationPckg, KNullDesC8, timePckg); sl@0: if(err==KErrNone) sl@0: { sl@0: aTime = timePckg(); sl@0: } sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::GetTimePlayed - Exit [%d]"), err); sl@0: return err; sl@0: } sl@0: sl@0: EXPORT_C TBool RMMFDevSoundProxy::IsResumeSupported() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::IsResumeSupported - Enter")); sl@0: TPckgBuf isResumeSupported; sl@0: TInt err = SendReceiveResult(EMMFDevSoundProxyIsResumeSupported, sl@0: iDestinationPckg, sl@0: KNullDesC8, sl@0: isResumeSupported); sl@0: if(err == KErrNone) sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::IsResumeSupported - Exit")); sl@0: return isResumeSupported(); sl@0: } sl@0: else sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::IsResumeSupported - Exit")); sl@0: return EFalse; sl@0: } sl@0: } sl@0: sl@0: EXPORT_C TInt RMMFDevSoundProxy::Resume() sl@0: { sl@0: SYMBIAN_DEBPRN0(_L("RMMFDevSoundProxy[0x%x]::Resume - Enter")); sl@0: TInt err = KErrNone; sl@0: if (!iDevSoundObserver || iState <= EInitialized ) sl@0: { sl@0: err = KErrNotReady; sl@0: } sl@0: else if(iState == ETonePlaying && iToneMode != ESequence) sl@0: { sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::Resume - Exit [%d]"), err); sl@0: return KErrNotSupported; sl@0: } sl@0: else sl@0: { sl@0: if (iState==ERecordingInLastBufferCycle) sl@0: { sl@0: // if we're in a last buffer cycle and get Resume() we have to be careful as the sl@0: // server side sent a PausedRecordCompleteEvent and did not actually request a buffer! sl@0: // just record the fact we've done this and wait until RecordData() is called sl@0: // don't actually resume until then! sl@0: iState = ERecordingResumingInLastBufferCycle; sl@0: } sl@0: else if (iState == ERecordingResumingInLastBufferCycle) sl@0: { sl@0: //Do Nothing as you can't resume twice on last buffer sl@0: } sl@0: else sl@0: { sl@0: err = SendReceive(EMMFDevSoundProxyResume, sl@0: iDestinationPckg); sl@0: } sl@0: } sl@0: SYMBIAN_DEBPRN1(_L("RMMFDevSoundProxy[0x%x]::Resume - Exit [%d]"), err); sl@0: return err; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RMMFDevSoundProxy::StartReceivingMsgQueueHandlerEventsL() sl@0: // Starts message queue handler (A/O) to monitor client side events sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void RMMFDevSoundProxy::StartReceivingMsgQueueHandlerEventsL(MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver) sl@0: { sl@0: if (iMsgQueueHandler) sl@0: { sl@0: iMsgQueueHandler->Cancel(); sl@0: } sl@0: else sl@0: { sl@0: iMsgQueueHandler = CMsgQueueHandler::NewL(this, sl@0: *this, sl@0: &iMsgQueue, sl@0: aDevSoundCIObserver); sl@0: } sl@0: sl@0: iMsgQueueHandler->ReceiveEvents(); sl@0: } sl@0: sl@0: // MDevSoundObserver sl@0: // intercept the calls from the msgQueueHandler going back to the client, so we can track real state sl@0: sl@0: void RMMFDevSoundProxy::InitializeComplete(TInt aError) sl@0: { sl@0: SYMBIAN_CHECK(iState==EInitializing, Panic(EMMFDevSoundProxyInitCompleteInWrongState)); sl@0: if (aError==KErrNone) sl@0: { sl@0: iState = EInitialized; sl@0: } sl@0: else sl@0: { sl@0: iState = EIdle; sl@0: } sl@0: iDevSoundObserver->InitializeComplete(aError); sl@0: } sl@0: sl@0: void RMMFDevSoundProxy::ToneFinished(TInt aError) sl@0: { sl@0: SYMBIAN_CHECK(iState==ETonePlaying, Panic(EMMFDevSoundProxyToneFinishedInWrongState)); sl@0: iState = EInitialized; sl@0: iDevSoundObserver->ToneFinished(aError); sl@0: } sl@0: sl@0: void RMMFDevSoundProxy::PlayError(TInt aError) sl@0: { sl@0: SYMBIAN_CHECK(iState==EPlaying||iState==EPlayingBufferWait, Panic(EMMFDevSoundProxyPlayErrorInWrongState)); sl@0: iState = EInitialized; sl@0: iDevSoundObserver->PlayError(aError); sl@0: } sl@0: sl@0: void RMMFDevSoundProxy::RecordError(TInt aError) sl@0: { sl@0: SYMBIAN_CHECK(iState==ERecording||iState==ERecordingBufferWait, Panic(EMMFDevSoundProxyRecordErrorInWrongState)); sl@0: iState = EInitialized; sl@0: iDevSoundObserver->RecordError(aError); sl@0: } sl@0: sl@0: void RMMFDevSoundProxy::BufferToBeFilled(CMMFBuffer* aBuffer) sl@0: { sl@0: SYMBIAN_CHECK(iState==EPlaying, Panic(EMMFDevSoundProxyBTBFInWrongState)); sl@0: iState = EPlayingBufferWait; sl@0: iBuffer = static_cast(aBuffer); // cache buffer for use in PlayData() later sl@0: iDevSoundObserver->BufferToBeFilled(aBuffer); sl@0: } sl@0: sl@0: void RMMFDevSoundProxy::BufferToBeEmptied(CMMFBuffer* aBuffer) sl@0: { sl@0: SYMBIAN_CHECK(iState==ERecording, Panic(EMMFDevSoundProxyBTBEInWrongState)); sl@0: if (aBuffer->LastBuffer()) sl@0: { sl@0: // this is end of recording. Assume have an empty buffer. Different state so that Resume() is handled as special case. sl@0: iState = ERecordingInLastBufferCycle; sl@0: } sl@0: else sl@0: { sl@0: iState = ERecordingBufferWait; sl@0: } sl@0: iDevSoundObserver->BufferToBeEmptied(aBuffer); sl@0: } sl@0: sl@0: void RMMFDevSoundProxy::ConvertError(TInt /*aError*/) sl@0: { sl@0: SYMBIAN_CHECK(EFalse, Panic(EMMFDevSoundProxyUnexpectedConvError)); sl@0: } sl@0: sl@0: void RMMFDevSoundProxy::DeviceMessage(TUid aMessageType, const TDesC8& aMsg) sl@0: { sl@0: iDevSoundObserver->DeviceMessage(aMessageType, aMsg); sl@0: } sl@0: sl@0: void RMMFDevSoundProxy::SendEventToClient(const TMMFEvent& aEvent) sl@0: { sl@0: iDevSoundObserver->SendEventToClient(aEvent); sl@0: } sl@0: sl@0: sl@0: // End of File