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 StereoWidening 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 sl@0: #include "StereoWideningProxy.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: // CStereoWidening::CStereoWidening sl@0: // C++ default constructor can NOT contain any code, that sl@0: // might leave. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CStereoWidening::CStereoWidening() sl@0: : iStereoWideningData(0, 0), sl@0: iDataPckgTo(iStereoWideningData) sl@0: { sl@0: } sl@0: sl@0: // Destructor sl@0: EXPORT_C CStereoWidening::~CStereoWidening() sl@0: { sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::NewL sl@0: // Static function for creating an instance of the StereoWidening object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CStereoWidening* CStereoWidening::NewL() sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: return NULL; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::NewL sl@0: // Static function for creating an instance of the StereoWidening object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CStereoWidening* CStereoWidening::NewL(CMdaAudioConvertUtility& aUtility , TBool aEnable, TInt8 aInitialLevel) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CStereoWideningProxy* stereoWideningProxy = (CStereoWideningProxy*)customInterface->CustomInterface(KUidStereoWideningEffect); sl@0: sl@0: if ( !stereoWideningProxy ) 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: stereoWideningProxy->SetStereoWideningLevelL(aInitialLevel); sl@0: sl@0: if(aEnable) sl@0: { sl@0: stereoWideningProxy->EnableL(); sl@0: } sl@0: sl@0: return stereoWideningProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::NewL sl@0: // Static function for creating an instance of the StereoWidening object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CStereoWidening* CStereoWidening::NewL( sl@0: CMdaAudioInputStream& aUtility, TBool aEnable, TInt8 aInitialLevel ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CStereoWideningProxy* stereoWideningProxy = (CStereoWideningProxy*)aUtility.CustomInterface(KUidStereoWideningEffect); sl@0: sl@0: if (stereoWideningProxy == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: stereoWideningProxy->SetStereoWideningLevelL(aInitialLevel); sl@0: sl@0: if(aEnable) sl@0: { sl@0: stereoWideningProxy->EnableL(); sl@0: } sl@0: sl@0: return stereoWideningProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::NewL sl@0: // Static function for creating an instance of the StereoWidening object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CStereoWidening* CStereoWidening::NewL( sl@0: CMdaAudioOutputStream& aUtility, TBool aEnable, TInt8 aInitialLevel ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CStereoWideningProxy* stereoWideningProxy = (CStereoWideningProxy*)aUtility.CustomInterface(KUidStereoWideningEffect); sl@0: sl@0: if (stereoWideningProxy == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: stereoWideningProxy->SetStereoWideningLevelL(aInitialLevel); sl@0: sl@0: if(aEnable) sl@0: { sl@0: stereoWideningProxy->EnableL(); sl@0: } sl@0: sl@0: return stereoWideningProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::NewL sl@0: // Static function for creating an instance of the StereoWidening object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CStereoWidening* CStereoWidening::NewL( sl@0: CMdaAudioPlayerUtility& aUtility , TBool aEnable, TInt8 aInitialLevel) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CStereoWideningProxy* stereoWideningProxy = (CStereoWideningProxy*)customInterface->CustomInterface(KUidStereoWideningEffect); sl@0: sl@0: if ( !stereoWideningProxy ) 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: stereoWideningProxy->SetStereoWideningLevelL(aInitialLevel); sl@0: sl@0: if(aEnable) sl@0: { sl@0: stereoWideningProxy->EnableL(); sl@0: } sl@0: sl@0: return stereoWideningProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::NewL sl@0: // Static function for creating an instance of the StereoWidening object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CStereoWidening* CStereoWidening::NewL( sl@0: CMdaAudioRecorderUtility& aUtility, sl@0: TBool aRecordStream, TBool aEnable, TInt8 aInitialLevel) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility, aRecordStream); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CStereoWideningProxy* stereoWideningProxy = (CStereoWideningProxy*)customInterface->CustomInterface(KUidStereoWideningEffect); sl@0: sl@0: if ( !stereoWideningProxy ) 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: stereoWideningProxy->SetStereoWideningLevelL(aInitialLevel); sl@0: sl@0: if(aEnable) sl@0: { sl@0: stereoWideningProxy->EnableL(); sl@0: } sl@0: sl@0: return stereoWideningProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::NewL sl@0: // Static function for creating an instance of the StereoWidening object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CStereoWidening* CStereoWidening::NewL( sl@0: CMdaAudioToneUtility& aUtility, TBool aEnable, TInt8 aInitialLevel) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CStereoWideningProxy* stereoWideningProxy = (CStereoWideningProxy*)aUtility.CustomInterface(KUidStereoWideningEffect); sl@0: sl@0: if (stereoWideningProxy == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: stereoWideningProxy->SetStereoWideningLevelL(aInitialLevel); sl@0: sl@0: if(aEnable) sl@0: { sl@0: stereoWideningProxy->EnableL(); sl@0: } sl@0: sl@0: return stereoWideningProxy; sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::NewL sl@0: // Static function for creating an instance of the StereoWidening object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CStereoWidening* CStereoWidening::NewL( sl@0: CMMFDevSound& aDevSound, TBool aEnable, TInt8 aInitialLevel) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CStereoWideningProxy* stereoWideningProxy = (CStereoWideningProxy*)aDevSound.CustomInterface(KUidStereoWideningEffect); sl@0: sl@0: if (stereoWideningProxy == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: stereoWideningProxy->SetStereoWideningLevelL(aInitialLevel); sl@0: sl@0: if(aEnable) sl@0: { sl@0: stereoWideningProxy->EnableL(); sl@0: } sl@0: sl@0: return stereoWideningProxy; sl@0: } sl@0: sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::NewL sl@0: // Static function for creating an instance of the StereoWidening object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CStereoWidening* CStereoWidening::NewL( sl@0: CCustomCommandUtility* aUtility , TBool aEnable, TInt8 aInitialLevel) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CStereoWideningProxy* stereoWideningProxy = (CStereoWideningProxy*)customInterface->CustomInterface(KUidStereoWideningEffect); sl@0: sl@0: if ( !stereoWideningProxy ) 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: stereoWideningProxy->SetStereoWideningLevelL(aInitialLevel); sl@0: sl@0: if(aEnable) sl@0: { sl@0: stereoWideningProxy->EnableL(); sl@0: } sl@0: sl@0: return stereoWideningProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::NewL sl@0: // Static function for creating an instance of the StereoWidening object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CStereoWidening* CStereoWidening::NewL( sl@0: MCustomInterface& aCustomInterface , TBool aEnable, TInt8 aInitialLevel) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CStereoWideningProxy* stereoWideningProxy = (CStereoWideningProxy*)aCustomInterface.CustomInterface(KUidStereoWideningEffect); sl@0: sl@0: if ( !stereoWideningProxy ) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: stereoWideningProxy->SetStereoWideningLevelL(aInitialLevel); sl@0: sl@0: if(aEnable) sl@0: { sl@0: stereoWideningProxy->EnableL(); sl@0: } sl@0: sl@0: return stereoWideningProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::NewL sl@0: // Static function for creating an instance of the StereoWidening object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CStereoWidening* CStereoWidening::NewL( sl@0: CMidiClientUtility& aUtility , TBool aEnable, TInt8 aInitialLevel ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CStereoWideningProxy* stereoWideningProxy = (CStereoWideningProxy*)customInterface->CustomInterface(KUidStereoWideningEffect); sl@0: sl@0: if ( !stereoWideningProxy ) 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: stereoWideningProxy->SetStereoWideningLevelL(aInitialLevel); sl@0: sl@0: if(aEnable) sl@0: { sl@0: stereoWideningProxy->EnableL(); sl@0: } sl@0: sl@0: return stereoWideningProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::NewL sl@0: // Static function for creating an instance of the StereoWidening object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CStereoWidening* CStereoWidening::NewL( sl@0: CDrmPlayerUtility& aUtility , TBool aEnable, TInt8 aInitialLevel ) sl@0: { sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CStereoWideningProxy* stereoWideningProxy = (CStereoWideningProxy*)customInterface->CustomInterface(KUidStereoWideningEffect); sl@0: sl@0: if ( !stereoWideningProxy ) 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: stereoWideningProxy->SetStereoWideningLevelL(aInitialLevel); sl@0: sl@0: if(aEnable) sl@0: { sl@0: stereoWideningProxy->EnableL(); sl@0: } sl@0: sl@0: return stereoWideningProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::NewL sl@0: // Static function for creating an instance of the StereoWidening object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CStereoWidening* CStereoWidening::NewL( sl@0: CVideoPlayerUtility& aUtility , TBool aEnable, TInt8 aInitialLevel ) sl@0: { sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CStereoWideningProxy* stereoWideningProxy = (CStereoWideningProxy*)customInterface->CustomInterface(KUidStereoWideningEffect); sl@0: sl@0: if ( !stereoWideningProxy ) 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: stereoWideningProxy->SetStereoWideningLevelL(aInitialLevel); sl@0: sl@0: if(aEnable) sl@0: { sl@0: stereoWideningProxy->EnableL(); sl@0: } sl@0: sl@0: return stereoWideningProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::BandLevel sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: sl@0: EXPORT_C TBool CStereoWidening::IsContinuousLevelSupported() const sl@0: { sl@0: return iStereoWideningData.iContinuousLevelSupported; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::BandWidth sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: sl@0: EXPORT_C void CStereoWidening::SetStereoWideningLevelL( TUint8 aLevel ) sl@0: { sl@0: iStereoWideningData.iLevel = aLevel; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::CenterFrequency sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TUint8 CStereoWidening::StereoWideningLevel() const sl@0: { sl@0: return iStereoWideningData.iLevel; sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::Uid sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TUid CStereoWidening::Uid() const sl@0: { sl@0: return KUidStereoWideningEffect; sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::DoEffectData sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C const TDesC8& CStereoWidening::DoEffectData() sl@0: { sl@0: DEBPRN0; sl@0: iDataPckgTo = iStereoWideningData; sl@0: return iDataPckgTo; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CStereoWidening::SetEffectData sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void CStereoWidening::SetEffectData( sl@0: const TDesC8& aEffectDataBuffer ) sl@0: { sl@0: DEBPRN0; sl@0: TEfStereoWideningDataPckg dataPckg; sl@0: dataPckg.Copy(aEffectDataBuffer); sl@0: iStereoWideningData = dataPckg(); sl@0: iEnabled = iStereoWideningData.iEnabled; sl@0: iEnforced = iStereoWideningData.iEnforced; sl@0: iHaveUpdateRights = iStereoWideningData.iHaveUpdateRights; sl@0: } sl@0: sl@0: sl@0: // ========================== OTHER EXPORTED FUNCTIONS ========================= sl@0: sl@0: // End of File sl@0: