devsoundextensions/effects/SrcDoppler/SourceDopplerEffect/Src/SourceDopplerEffect.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:38:50 +0100
branchRCL_3
changeset 50 948c7f65f6d4
parent 0 40261b775718
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201028 Kit: 201035

/*
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:   Implementation of the Source Doppler Effect class
*
*/




// INCLUDE FILES

#ifdef _DEBUG
#include <e32svr.h>
#endif

#include <SourceDopplerBase.h>
#include <CustomInterfaceUtility.h>
#include "SourceDopplerProxy.h"
#include <DrmAudioSamplePlayer.h>
#include <mdaaudioinputstream.h>
#include <mdaaudiooutputstream.h>
#include <mdaaudiotoneplayer.h>
#include <mmf/server/sounddevice.h>
#include <videoplayer.h>

#ifdef _DEBUG
#define DEBPRN0         RDebug::Printf( "%s", __PRETTY_FUNCTION__);
#define DEBPRN1(str)    RDebug::Printf( "%s %s", __PRETTY_FUNCTION__, str );
#else
#define DEBPRN0
#define DEBPRN1(str)
#endif

// ============================ MEMBER FUNCTIONS ===============================

// -----------------------------------------------------------------------------
// CSourceDoppler::CSourceDoppler
// C++ default constructor can NOT contain any code, that
// might leave.
// -----------------------------------------------------------------------------
//
EXPORT_C CSourceDoppler::CSourceDoppler()
    {
    }

// Destructor
EXPORT_C CSourceDoppler::~CSourceDoppler()
    {
    }


// -----------------------------------------------------------------------------
// CSourceDoppler::NewL
// Static function for creating an instance of the Doppler object.
// -----------------------------------------------------------------------------
//
EXPORT_C CSourceDoppler* CSourceDoppler::NewL(
	CMdaAudioInputStream& aUtility )
	{

    DEBPRN0;
    CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)aUtility.CustomInterface(KUidSourceDopplerEffect);

	if (dopplerProxy == NULL)
		{
        DEBPRN1("No Adaptation Support - leaving");
    	User::Leave(KErrNotSupported);
		}

    return dopplerProxy;
	}

// -----------------------------------------------------------------------------
// CSourceDoppler::NewL
// Static function for creating an instance of the Doppler object.
// -----------------------------------------------------------------------------
//
EXPORT_C CSourceDoppler* CSourceDoppler::NewL(
	CMdaAudioOutputStream& aUtility )
	{

	DEBPRN0;
    CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)aUtility.CustomInterface(KUidSourceDopplerEffect);

	if (dopplerProxy == NULL)
		{
        DEBPRN1("No Adaptation Support - leaving");
    	User::Leave(KErrNotSupported);
		}

    return dopplerProxy;
	}

// -----------------------------------------------------------------------------
// CSourceDoppler::NewL
// Static function for creating an instance of the Doppler object.
// -----------------------------------------------------------------------------
//
EXPORT_C CSourceDoppler* CSourceDoppler::NewL(
	CMdaAudioConvertUtility& aUtility )
	{

    DEBPRN0;
   	CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
    CleanupStack::PushL(customInterface);

	CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)customInterface->CustomInterface(KUidSourceDopplerEffect);

	if ( !dopplerProxy )
		{
		DEBPRN1("No Adaptation Support - leaving");
		User::Leave(KErrNotSupported);
		}

	CleanupStack::Pop(customInterface);

    return dopplerProxy;
	}

// -----------------------------------------------------------------------------
// CSourceDoppler::NewL
// Static function for creating an instance of the Doppler object.
// -----------------------------------------------------------------------------
//
EXPORT_C CSourceDoppler* CSourceDoppler::NewL(
	CMdaAudioPlayerUtility& aUtility )
	{

    DEBPRN0;
   	CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
    CleanupStack::PushL(customInterface);

	CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)customInterface->CustomInterface(KUidSourceDopplerEffect);

	if ( !dopplerProxy )
		{
		DEBPRN1("No Adaptation Support - leaving");
		User::Leave(KErrNotSupported);
		}

	CleanupStack::Pop(customInterface);

    return dopplerProxy;
	}

// -----------------------------------------------------------------------------
// CSourceDoppler::NewL
// Static function for creating an instance of the Doppler object.
// -----------------------------------------------------------------------------
//
EXPORT_C CSourceDoppler* CSourceDoppler::NewL(
	CMdaAudioRecorderUtility& aUtility,
	TBool aRecordStream )
	{

    DEBPRN0;
   	CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility, aRecordStream);
    CleanupStack::PushL(customInterface);

	CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)customInterface->CustomInterface(KUidSourceDopplerEffect);

	if ( !dopplerProxy )
		{
		DEBPRN1("No Adaptation Support - leaving");
		User::Leave(KErrNotSupported);
		}

	CleanupStack::Pop(customInterface);

    return dopplerProxy;
	}

// -----------------------------------------------------------------------------
// CSourceDoppler::NewL
// Static function for creating an instance of the Doppler object.
// -----------------------------------------------------------------------------
//
EXPORT_C CSourceDoppler* CSourceDoppler::NewL(
	CMdaAudioToneUtility& aUtility )
	{

	DEBPRN0;
    CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)aUtility.CustomInterface(KUidSourceDopplerEffect);

	if (dopplerProxy == NULL)
		{
        DEBPRN1("No Adaptation Support - leaving");
    	User::Leave(KErrNotSupported);
		}

    return dopplerProxy;
	}

// -----------------------------------------------------------------------------
// CSourceDoppler::NewL
// Static function for creating an instance of the Doppler object.
// -----------------------------------------------------------------------------
//
EXPORT_C CSourceDoppler* CSourceDoppler::NewL(
	CMMFDevSound& aDevSound)
	{

	DEBPRN0;
    CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)aDevSound.CustomInterface(KUidSourceDopplerEffect);

	if (dopplerProxy == NULL)
		{
        DEBPRN1("No Adaptation Support - leaving");
    	User::Leave(KErrNotSupported);
		}

    return dopplerProxy;
	}

// -----------------------------------------------------------------------------
// CSourceDoppler::NewL
// Static function for creating an instance of the Doppler object.
// -----------------------------------------------------------------------------
//
EXPORT_C CSourceDoppler* CSourceDoppler::NewL(
	CCustomCommandUtility* aUtility)
	{

    DEBPRN0;
   	CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
    CleanupStack::PushL(customInterface);

	CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)customInterface->CustomInterface(KUidSourceDopplerEffect);

	if ( !dopplerProxy )
		{
		DEBPRN1("No Adaptation Support - leaving");
		User::Leave(KErrNotSupported);
		}

	CleanupStack::Pop(customInterface);

    return dopplerProxy;
	}

// -----------------------------------------------------------------------------
// CSourceDoppler::NewL
// Static function for creating an instance of the Doppler object.
// -----------------------------------------------------------------------------
//
EXPORT_C CSourceDoppler* CSourceDoppler::NewL(
	MCustomInterface& aCustomInterface )
	{

    DEBPRN0;
	CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)aCustomInterface.CustomInterface(KUidSourceDopplerEffect);

	if ( !dopplerProxy )
		{
		DEBPRN1("No Adaptation Support - leaving");
		User::Leave(KErrNotSupported);
		}

    return dopplerProxy;
	}

// -----------------------------------------------------------------------------
// CSourceDoppler::NewL
// Static function for creating an instance of the Doppler object.
// -----------------------------------------------------------------------------
//
EXPORT_C CSourceDoppler* CSourceDoppler::NewL(
	CMidiClientUtility& aUtility )
	{

    DEBPRN0;
   	CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
    CleanupStack::PushL(customInterface);

	CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)customInterface->CustomInterface(KUidSourceDopplerEffect);

	if ( !dopplerProxy )
		{
		DEBPRN1("No Adaptation Support - leaving");
		User::Leave(KErrNotSupported);
		}

	CleanupStack::Pop(customInterface);

    return dopplerProxy;
	}

// -----------------------------------------------------------------------------
// CSourceDoppler::NewL
// Static function for creating an instance of the Doppler object.
// -----------------------------------------------------------------------------
//
EXPORT_C CSourceDoppler* CSourceDoppler::NewL(
	CDrmPlayerUtility& aUtility )
	{

    DEBPRN0;
   	CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
    CleanupStack::PushL(customInterface);

	CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)customInterface->CustomInterface(KUidSourceDopplerEffect);

	if ( !dopplerProxy )
		{
		DEBPRN1("No Adaptation Support - leaving");
		User::Leave(KErrNotSupported);
		}

	CleanupStack::Pop(customInterface);

    return dopplerProxy;
	}

// -----------------------------------------------------------------------------
// CSourceDoppler::NewL
// Static function for creating an instance of the Doppler object.
// -----------------------------------------------------------------------------
//
EXPORT_C CSourceDoppler* CSourceDoppler::NewL(
	CVideoPlayerUtility& aUtility )
	{

    DEBPRN0;
   	CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
    CleanupStack::PushL(customInterface);

	CSourceDopplerProxy* dopplerProxy = (CSourceDopplerProxy*)customInterface->CustomInterface(KUidSourceDopplerEffect);

	if ( !dopplerProxy )
		{
		DEBPRN1("No Adaptation Support - leaving");
		User::Leave(KErrNotSupported);
		}

	CleanupStack::Pop(customInterface);

    return dopplerProxy;
	}

// -----------------------------------------------------------------------------
// CSourceDoppler::Uid
// -----------------------------------------------------------------------------
//
EXPORT_C TUid CSourceDoppler::Uid() const
	{
	return KUidSourceDopplerEffect;
	}


// ========================== OTHER EXPORTED FUNCTIONS =========================

// End of File