sl@0: /* sl@0: * Copyright (c) 2006 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: Implementation of the bassboost effect class sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: sl@0: // INCLUDE FILES sl@0: sl@0: #ifdef _DEBUG sl@0: #include sl@0: #endif sl@0: sl@0: #include sl@0: #include sl@0: #include "BassBoostProxy.h" sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #ifdef _DEBUG sl@0: #define DEBPRN0 RDebug::Printf( "%s", __PRETTY_FUNCTION__); sl@0: #define DEBPRN1(str) RDebug::Printf( "%s %s", __PRETTY_FUNCTION__, str ); sl@0: #else sl@0: #define DEBPRN0 sl@0: #define DEBPRN1(str) sl@0: #endif sl@0: sl@0: // ============================ MEMBER FUNCTIONS =============================== sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBassBoost::CBassBoost sl@0: // C++ default constructor can NOT contain any code, that sl@0: // might leave. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CBassBoost::CBassBoost() sl@0: : iBassBoostData(), sl@0: iDataPckgTo(iBassBoostData), sl@0: iDataPckgFrom(iBassBoostData) sl@0: { sl@0: } sl@0: sl@0: // Destructor sl@0: EXPORT_C CBassBoost::~CBassBoost() sl@0: { sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBassBoost::NewL sl@0: // Static function for creating an instance of the BassBoost object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CBassBoost* CBassBoost::NewL( sl@0: CMdaAudioInputStream& aUtility, TBool aEnable) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)aUtility.CustomInterface(KUidBassBoostEffect); sl@0: sl@0: if (bassboostProxy == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: if(aEnable) sl@0: { sl@0: bassboostProxy->EnableL(); sl@0: } sl@0: sl@0: return bassboostProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBassBoost::NewL sl@0: // Static function for creating an instance of the BassBoost object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CBassBoost* CBassBoost::NewL( sl@0: CMdaAudioOutputStream& aUtility , TBool aEnable) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)aUtility.CustomInterface(KUidBassBoostEffect); sl@0: sl@0: if (bassboostProxy == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: if(aEnable) sl@0: { sl@0: bassboostProxy->EnableL(); sl@0: } sl@0: sl@0: return bassboostProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBassBoost::NewL sl@0: // Static function for creating an instance of the BassBoost object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CBassBoost* CBassBoost::NewL( sl@0: CMdaAudioConvertUtility& aUtility , TBool aEnable) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)customInterface->CustomInterface(KUidBassBoostEffect); sl@0: sl@0: if ( !bassboostProxy ) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: CleanupStack::Pop(customInterface); sl@0: sl@0: if(aEnable) sl@0: { sl@0: bassboostProxy->EnableL(); sl@0: } sl@0: sl@0: return bassboostProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBassBoost::NewL sl@0: // Static function for creating an instance of the BassBoost object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CBassBoost* CBassBoost::NewL( sl@0: CMdaAudioPlayerUtility& aUtility , TBool aEnable) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)customInterface->CustomInterface(KUidBassBoostEffect); sl@0: sl@0: if ( !bassboostProxy ) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: CleanupStack::Pop(customInterface); sl@0: sl@0: if(aEnable) sl@0: { sl@0: bassboostProxy->EnableL(); sl@0: } sl@0: sl@0: return bassboostProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBassBoost::NewL sl@0: // Static function for creating an instance of the BassBoost object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CBassBoost* CBassBoost::NewL( sl@0: CMdaAudioRecorderUtility& aUtility, sl@0: TBool aRecordStream , TBool aEnable) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility, aRecordStream); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)customInterface->CustomInterface(KUidBassBoostEffect); sl@0: sl@0: if ( !bassboostProxy ) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: CleanupStack::Pop(customInterface); sl@0: sl@0: if(aEnable) sl@0: { sl@0: bassboostProxy->EnableL(); sl@0: } sl@0: sl@0: return bassboostProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBassBoost::NewL sl@0: // Static function for creating an instance of the BassBoost object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CBassBoost* CBassBoost::NewL( sl@0: CMdaAudioToneUtility& aUtility, TBool aEnable) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)aUtility.CustomInterface(KUidBassBoostEffect); sl@0: sl@0: if (bassboostProxy == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: if(aEnable) sl@0: { sl@0: bassboostProxy->EnableL(); sl@0: } sl@0: sl@0: return bassboostProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBassBoost::NewL sl@0: // Static function for creating an instance of the BassBoost object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CBassBoost* CBassBoost::NewL( sl@0: CMMFDevSound& aDevSound, TBool aEnable ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)aDevSound.CustomInterface(KUidBassBoostEffect); sl@0: sl@0: if (bassboostProxy == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: if(aEnable) sl@0: { sl@0: bassboostProxy->EnableL(); sl@0: } sl@0: sl@0: return bassboostProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBassBoost::NewL sl@0: // Static function for creating an instance of the BassBoost object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CBassBoost* CBassBoost::NewL( sl@0: CCustomCommandUtility* aUtility, TBool aEnable ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)customInterface->CustomInterface(KUidBassBoostEffect); sl@0: sl@0: if ( !bassboostProxy ) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: CleanupStack::Pop(customInterface); sl@0: sl@0: if(aEnable) sl@0: { sl@0: bassboostProxy->EnableL(); sl@0: } sl@0: sl@0: return bassboostProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBassBoost::NewL sl@0: // Static function for creating an instance of the BassBoost object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CBassBoost* CBassBoost::NewL( sl@0: MCustomInterface& aCustomInterface , TBool aEnable) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CBassBoost* bassboostProxy = (CBassBoost*)aCustomInterface.CustomInterface(KUidBassBoostEffect); sl@0: sl@0: if ( !bassboostProxy ) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: if(aEnable) sl@0: { sl@0: bassboostProxy->EnableL(); sl@0: } sl@0: sl@0: return bassboostProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBassBoost::NewL sl@0: // Static function for creating an instance of the BassBoost object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CBassBoost* CBassBoost::NewL( sl@0: CMidiClientUtility& aUtility, TBool aEnable ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)customInterface->CustomInterface(KUidBassBoostEffect); sl@0: sl@0: if ( !bassboostProxy ) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: CleanupStack::Pop(customInterface); sl@0: sl@0: if(aEnable) sl@0: { sl@0: bassboostProxy->EnableL(); sl@0: } sl@0: sl@0: return bassboostProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBassBoost::NewL sl@0: // Static function for creating an instance of the BassBoost object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CBassBoost* CBassBoost::NewL( sl@0: CDrmPlayerUtility& aUtility, TBool aEnable) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)customInterface->CustomInterface(KUidBassBoostEffect); sl@0: sl@0: if ( !bassboostProxy ) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: CleanupStack::Pop(customInterface); sl@0: sl@0: if(aEnable) sl@0: { sl@0: bassboostProxy->EnableL(); sl@0: } sl@0: sl@0: return bassboostProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBassBoost::NewL sl@0: // Static function for creating an instance of the BassBoost object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CBassBoost* CBassBoost::NewL( sl@0: CVideoPlayerUtility& aUtility, TBool aEnable) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)customInterface->CustomInterface(KUidBassBoostEffect); sl@0: sl@0: if ( !bassboostProxy ) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: CleanupStack::Pop(customInterface); sl@0: sl@0: if(aEnable) sl@0: { sl@0: bassboostProxy->EnableL(); sl@0: } sl@0: sl@0: return bassboostProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBassBoost::DoEffectData sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C const TDesC8& CBassBoost::DoEffectData() sl@0: { sl@0: DEBPRN0; sl@0: iDataPckgTo = iBassBoostData; sl@0: return iDataPckgTo; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBassBoost::SetEffectData sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void CBassBoost::SetEffectData( sl@0: const TDesC8& aEffectDataBuffer ) sl@0: { sl@0: DEBPRN0; sl@0: TEfBassBoostDataPckg dataPckg; sl@0: dataPckg.Copy(aEffectDataBuffer); sl@0: iBassBoostData = dataPckg(); sl@0: iEnabled = iBassBoostData.iEnabled; sl@0: iEnforced = iBassBoostData.iEnforced; sl@0: iHaveUpdateRights = iBassBoostData.iHaveUpdateRights; sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBassBoost::Uid sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TUid CBassBoost::Uid() const sl@0: { sl@0: return KUidBassBoostEffect; sl@0: } sl@0: sl@0: sl@0: // ========================== OTHER EXPORTED FUNCTIONS ========================= sl@0: sl@0: