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 Source Doppler 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 "SourceDopplerProxy.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: // CSourceDoppler::CSourceDoppler sl@0: // C++ default constructor can NOT contain any code, that sl@0: // might leave. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CSourceDoppler::CSourceDoppler() sl@0: { sl@0: } sl@0: sl@0: // Destructor sl@0: EXPORT_C CSourceDoppler::~CSourceDoppler() sl@0: { sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CSourceDoppler::NewL sl@0: // Static function for creating an instance of the Doppler object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CSourceDoppler* CSourceDoppler::NewL( sl@0: CMdaAudioInputStream& aUtility ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)aUtility.CustomInterface(KUidSourceDopplerEffect); sl@0: sl@0: if (dopplerProxy == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: return dopplerProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CSourceDoppler::NewL sl@0: // Static function for creating an instance of the Doppler object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CSourceDoppler* CSourceDoppler::NewL( sl@0: CMdaAudioOutputStream& aUtility ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)aUtility.CustomInterface(KUidSourceDopplerEffect); sl@0: sl@0: if (dopplerProxy == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: return dopplerProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CSourceDoppler::NewL sl@0: // Static function for creating an instance of the Doppler object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CSourceDoppler* CSourceDoppler::NewL( sl@0: CMdaAudioConvertUtility& aUtility ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)customInterface->CustomInterface(KUidSourceDopplerEffect); sl@0: sl@0: if ( !dopplerProxy ) 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: return dopplerProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CSourceDoppler::NewL sl@0: // Static function for creating an instance of the Doppler object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CSourceDoppler* CSourceDoppler::NewL( sl@0: CMdaAudioPlayerUtility& aUtility ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)customInterface->CustomInterface(KUidSourceDopplerEffect); sl@0: sl@0: if ( !dopplerProxy ) 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: return dopplerProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CSourceDoppler::NewL sl@0: // Static function for creating an instance of the Doppler object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CSourceDoppler* CSourceDoppler::NewL( sl@0: CMdaAudioRecorderUtility& aUtility, sl@0: TBool aRecordStream ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility, aRecordStream); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)customInterface->CustomInterface(KUidSourceDopplerEffect); sl@0: sl@0: if ( !dopplerProxy ) 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: return dopplerProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CSourceDoppler::NewL sl@0: // Static function for creating an instance of the Doppler object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CSourceDoppler* CSourceDoppler::NewL( sl@0: CMdaAudioToneUtility& aUtility ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)aUtility.CustomInterface(KUidSourceDopplerEffect); sl@0: sl@0: if (dopplerProxy == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: return dopplerProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CSourceDoppler::NewL sl@0: // Static function for creating an instance of the Doppler object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CSourceDoppler* CSourceDoppler::NewL( sl@0: CMMFDevSound& aDevSound) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)aDevSound.CustomInterface(KUidSourceDopplerEffect); sl@0: sl@0: if (dopplerProxy == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: return dopplerProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CSourceDoppler::NewL sl@0: // Static function for creating an instance of the Doppler object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CSourceDoppler* CSourceDoppler::NewL( sl@0: CCustomCommandUtility* aUtility) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)customInterface->CustomInterface(KUidSourceDopplerEffect); sl@0: sl@0: if ( !dopplerProxy ) 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: return dopplerProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CSourceDoppler::NewL sl@0: // Static function for creating an instance of the Doppler object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CSourceDoppler* CSourceDoppler::NewL( sl@0: MCustomInterface& aCustomInterface ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)aCustomInterface.CustomInterface(KUidSourceDopplerEffect); sl@0: sl@0: if ( !dopplerProxy ) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: return dopplerProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CSourceDoppler::NewL sl@0: // Static function for creating an instance of the Doppler object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CSourceDoppler* CSourceDoppler::NewL( sl@0: CMidiClientUtility& aUtility ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)customInterface->CustomInterface(KUidSourceDopplerEffect); sl@0: sl@0: if ( !dopplerProxy ) 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: return dopplerProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CSourceDoppler::NewL sl@0: // Static function for creating an instance of the Doppler object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CSourceDoppler* CSourceDoppler::NewL( sl@0: CDrmPlayerUtility& aUtility ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)customInterface->CustomInterface(KUidSourceDopplerEffect); sl@0: sl@0: if ( !dopplerProxy ) 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: return dopplerProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CSourceDoppler::NewL sl@0: // Static function for creating an instance of the Doppler object. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CSourceDoppler* CSourceDoppler::NewL( sl@0: CVideoPlayerUtility& aUtility ) sl@0: { sl@0: sl@0: DEBPRN0; sl@0: CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL(customInterface); sl@0: sl@0: CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)customInterface->CustomInterface(KUidSourceDopplerEffect); sl@0: sl@0: if ( !dopplerProxy ) 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: return dopplerProxy; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CSourceDoppler::Uid sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TUid CSourceDoppler::Uid() const sl@0: { sl@0: return KUidSourceDopplerEffect; sl@0: } sl@0: sl@0: sl@0: // ========================== OTHER EXPORTED FUNCTIONS ========================= sl@0: sl@0: // End of File