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 RoomLevel 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 "RoomLevelProxy.h" sl@0: sl@0: #include sl@0: #include 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: // CRoomLevel::CRoomLevel sl@0: // C++ default constructor can NOT contain any code, that sl@0: // might leave. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CRoomLevel::CRoomLevel() sl@0: : iRoomLevelData(), sl@0: iDataPckgTo(iRoomLevelData) sl@0: { sl@0: sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::~CRoomLevel sl@0: // Destructor sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: // sl@0: EXPORT_C CRoomLevel::~CRoomLevel() sl@0: { sl@0: sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::NewL sl@0: // Static function for creating an instance of the RoomLevel object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CRoomLevel* CRoomLevel::NewL( sl@0: CMdaAudioConvertUtility& aUtility, CEnvironmentalReverb& aReverb ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CRoomLevelProxy* roomLevelProxy = (CRoomLevelProxy*)customInterface->CustomInterface(KUidRoomLevelEffect); sl@0: sl@0: if ( !roomLevelProxy ) 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: roomLevelProxy->iClientReverb = &aReverb; sl@0: roomLevelProxy->AttachReverb(aReverb); sl@0: sl@0: return roomLevelProxy; sl@0: sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::NewL sl@0: // Static function for creating an instance of the RoomLevel object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CRoomLevel* CRoomLevel::NewL( sl@0: CMdaAudioInputStream& aUtility, CEnvironmentalReverb& aReverb ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CRoomLevelProxy* roomLevelProxy = (CRoomLevelProxy*)aUtility.CustomInterface(KUidRoomLevelEffect); sl@0: sl@0: if (roomLevelProxy == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: roomLevelProxy->iClientReverb = &aReverb; sl@0: roomLevelProxy->AttachReverb(aReverb); sl@0: sl@0: return roomLevelProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::NewL sl@0: // Static function for creating an instance of the RoomLevel object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CRoomLevel* CRoomLevel::NewL( sl@0: CMdaAudioOutputStream& aUtility, CEnvironmentalReverb& aReverb ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CRoomLevelProxy* roomLevelProxy = (CRoomLevelProxy*)aUtility.CustomInterface(KUidRoomLevelEffect); sl@0: sl@0: if (roomLevelProxy == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: roomLevelProxy->iClientReverb = &aReverb; sl@0: roomLevelProxy->AttachReverb(aReverb); sl@0: sl@0: return roomLevelProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::NewL sl@0: // Static function for creating an instance of the RoomLevel object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CRoomLevel* CRoomLevel::NewL( sl@0: CMdaAudioPlayerUtility& aUtility, CEnvironmentalReverb& aReverb ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CRoomLevelProxy* roomLevelProxy = (CRoomLevelProxy*)customInterface->CustomInterface(KUidRoomLevelEffect); sl@0: sl@0: if ( !roomLevelProxy ) 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: sl@0: roomLevelProxy->iClientReverb = &aReverb; sl@0: roomLevelProxy->AttachReverb(aReverb); sl@0: sl@0: return roomLevelProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::NewL sl@0: // Static function for creating an instance of the RoomLevel object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CRoomLevel* CRoomLevel::NewL( sl@0: CMdaAudioRecorderUtility& aUtility, sl@0: TBool aRecordStream, CEnvironmentalReverb& aReverb ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility, aRecordStream); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CRoomLevelProxy* roomLevelProxy = (CRoomLevelProxy*)customInterface->CustomInterface(KUidRoomLevelEffect); sl@0: sl@0: if ( !roomLevelProxy ) 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: roomLevelProxy->iClientReverb = &aReverb; sl@0: roomLevelProxy->AttachReverb(aReverb); sl@0: sl@0: return roomLevelProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::NewL sl@0: // Static function for creating an instance of the RoomLevel object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CRoomLevel* CRoomLevel::NewL( sl@0: CMdaAudioToneUtility& aUtility, CEnvironmentalReverb& aReverb ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CRoomLevelProxy* roomLevelProxy = (CRoomLevelProxy*)aUtility.CustomInterface(KUidRoomLevelEffect); sl@0: sl@0: if (roomLevelProxy == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: roomLevelProxy->iClientReverb = &aReverb; sl@0: roomLevelProxy->AttachReverb(aReverb); sl@0: sl@0: return roomLevelProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CAudioEqualizer::NewL sl@0: // Static function for creating an instance of the RoomLevel object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CRoomLevel* CRoomLevel::NewL( sl@0: CMMFDevSound& aDevSound, CEnvironmentalReverb& aReverb ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CRoomLevelProxy* roomLevelProxy = (CRoomLevelProxy*)aDevSound.CustomInterface(KUidRoomLevelEffect); sl@0: sl@0: if (roomLevelProxy == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: roomLevelProxy->iClientReverb = &aReverb; sl@0: roomLevelProxy->AttachReverb(aReverb); sl@0: sl@0: return roomLevelProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::NewL sl@0: // Static function for creating an instance of the RoomLevel object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CRoomLevel* CRoomLevel::NewL( sl@0: CCustomCommandUtility* aUtility, CEnvironmentalReverb& aReverb ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CRoomLevelProxy* roomLevelProxy = (CRoomLevelProxy*)customInterface->CustomInterface(KUidRoomLevelEffect); sl@0: sl@0: if ( !roomLevelProxy ) 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: roomLevelProxy->iClientReverb = &aReverb; sl@0: roomLevelProxy->AttachReverb(aReverb); sl@0: sl@0: return roomLevelProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::NewL sl@0: // Static function for creating an instance of the RoomLevel object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CRoomLevel* CRoomLevel::NewL( sl@0: MCustomInterface& aCustomInterface, CEnvironmentalReverb& aReverb ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CRoomLevelProxy* roomLevelProxy = (CRoomLevelProxy*)aCustomInterface.CustomInterface(KUidRoomLevelEffect); sl@0: if ( !roomLevelProxy ) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: roomLevelProxy->iClientReverb = &aReverb; sl@0: sl@0: roomLevelProxy->AttachReverb(aReverb); sl@0: sl@0: return roomLevelProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::NewL sl@0: // Static function for creating an instance of the RoomLevel object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CRoomLevel* CRoomLevel::NewL( sl@0: CMidiClientUtility& aUtility, CEnvironmentalReverb& aReverb) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CRoomLevelProxy* roomLevelProxy = (CRoomLevelProxy*)customInterface->CustomInterface(KUidRoomLevelEffect); sl@0: sl@0: if ( !roomLevelProxy ) 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: roomLevelProxy->iClientReverb = &aReverb; sl@0: sl@0: roomLevelProxy->AttachReverb(aReverb); sl@0: sl@0: return roomLevelProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::NewL sl@0: // Static function for creating an instance of the RoomLevel object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CRoomLevel* CRoomLevel::NewL( sl@0: CDrmPlayerUtility& aUtility, CEnvironmentalReverb& aReverb) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CRoomLevelProxy* roomLevelProxy = (CRoomLevelProxy*)customInterface->CustomInterface(KUidRoomLevelEffect); sl@0: sl@0: if ( !roomLevelProxy ) 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: roomLevelProxy->iClientReverb = &aReverb; sl@0: sl@0: roomLevelProxy->AttachReverb(aReverb); sl@0: sl@0: return roomLevelProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::NewL sl@0: // Static function for creating an instance of the RoomLevel object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CRoomLevel* CRoomLevel::NewL( sl@0: CVideoPlayerUtility& aUtility, CEnvironmentalReverb& aReverb) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CRoomLevelProxy* roomLevelProxy = (CRoomLevelProxy*)customInterface->CustomInterface(KUidRoomLevelEffect); sl@0: sl@0: if ( !roomLevelProxy ) 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: roomLevelProxy->iClientReverb = &aReverb; sl@0: sl@0: roomLevelProxy->AttachReverb(aReverb); sl@0: sl@0: return roomLevelProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::RoomLevel sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt32 CRoomLevel::Level() const sl@0: { sl@0: return iRoomLevelData.iStreamRoomLevel; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::RoomLevelLevelRange sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void CRoomLevel::LevelRange( sl@0: TInt32& aMin, sl@0: TInt32& aMax) sl@0: { sl@0: sl@0: aMin = iRoomLevelData.iStreamMinRoomLevel; sl@0: aMax = iRoomLevelData.iStreamMaxRoomLevel; sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::SetRoomLevelL sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void CRoomLevel::SetRoomLevelL( sl@0: TInt32 aRoomLevel ) sl@0: { sl@0: if ( (aRoomLevel >= iRoomLevelData.iStreamMinRoomLevel) && (aRoomLevel <= iRoomLevelData.iStreamMaxRoomLevel) ) sl@0: { sl@0: iRoomLevelData.iStreamRoomLevel = aRoomLevel; sl@0: } sl@0: else sl@0: { sl@0: User::Leave(KErrArgument); sl@0: } sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::Uid sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TUid CRoomLevel::Uid() const sl@0: { sl@0: return KUidRoomLevelEffect; sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::DoEffectData sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C const TDesC8& CRoomLevel::DoEffectData() sl@0: { sl@0: DEBPRN0; sl@0: iDataPckgTo = iRoomLevelData; sl@0: return iDataPckgTo; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CRoomLevel::SetEffectData sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void CRoomLevel::SetEffectData( sl@0: const TDesC8& aEffectDataBuffer ) sl@0: { sl@0: DEBPRN0; sl@0: TEfRoomLevelDataPckg dataPckg; sl@0: dataPckg.Copy(aEffectDataBuffer); sl@0: iRoomLevelData = dataPckg(); sl@0: iEnabled = iRoomLevelData.iEnabled; sl@0: iEnforced = iRoomLevelData.iEnforced; sl@0: iHaveUpdateRights = iRoomLevelData.iHaveUpdateRights; sl@0: } sl@0: sl@0: sl@0: // ========================== OTHER EXPORTED FUNCTIONS ========================= sl@0: sl@0: