audiostubs/devsoundextensions_stubs/audioeffectscistubs/sourcedopplercistub/src/SourceDopplerCIStub.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 14 Jan 2010 07:14:53 +0200
changeset 0 0ce1b5ce9557
child 3 f935d51494d1
permissions -rw-r--r--
Revision: 201001

/*
* Copyright (c) 2004 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: Audio Stubs -  Implementation of the Source Doppler Effect Custom Interface class
*
*/


#ifdef _DEBUG
#include <e32svr.h> // Needed for RDebug Prints
#endif

#include "SourceDopplerCI.h"
#include <sounddevice.h>

// -----------------------------------------------------------------------------
// CSourceDoppler::NewL
// Static function for creating an instance of the CSourceDopplerCI object.
// -----------------------------------------------------------------------------
//

EXPORT_C CSourceDopplerCI* CSourceDopplerCI::NewL(
	CMMFDevSound& aDevSound )
	{
	CSourceDopplerCI* self = new(ELeave) CSourceDopplerCI(aDevSound);
	return self;
	}

CSourceDopplerCI::CSourceDopplerCI(
	CMMFDevSound& aDevSound )
	:	iDevSound(&aDevSound)
	{
	iDopplerData.iVelocityX = 10;
	iDopplerData.iVelocityY = 10;
	iDopplerData.iVelocityZ = 10;
	iDopplerData.iAzimuth = 20;
	iDopplerData.iElevation = 20;
	iDopplerData.iRadius = 20;
	iDopplerData.iFactor = 5;
	iDopplerData.iMaxFactor = 10;
	}

// -----------------------------------------------------------------------------
// CSourceDoppler::NewL
// Static function for creating an instance of the CSourceDopplerCI object.
// -----------------------------------------------------------------------------
//

EXPORT_C CSourceDopplerCI* CSourceDopplerCI::NewL()
	{
	CSourceDopplerCI* self = new(ELeave) CSourceDopplerCI();
	return self;
	}

CSourceDopplerCI::CSourceDopplerCI()
	{
	iDopplerData.iVelocityX = 10;
	iDopplerData.iVelocityY = 10;
	iDopplerData.iVelocityZ = 10;
	iDopplerData.iAzimuth = 20;
	iDopplerData.iElevation = 20;
	iDopplerData.iRadius = 20;
	iDopplerData.iFactor = 5;
	iDopplerData.iMaxFactor = 10;
	}

// Destructor

CSourceDopplerCI::~CSourceDopplerCI()
	{
#ifdef _DEBUG
    RDebug::Print(_L("CSourceDopplerCI::~CSourceDopplerCI"));
#endif
	}

// -----------------------------------------------------------------------------
// CSourceDopplerCI::ApplyL
//
// Applies the SourceDoppler settings.
// Adaptation must check each settings and take appropriate actions since
// this method might be called after several settings have been made.
// -----------------------------------------------------------------------------
//
void CSourceDopplerCI::ApplyL()
	{
#ifdef _DEBUG
    RDebug::Print(_L("CSourceDopplerCI::ApplyL"));
#endif

	if ( !HaveUpdateRights() )
		{
		User::Leave(KErrAccessDenied);
		}

	if (iObservers.Count() > 0)
		{
		if(iDopplerData.iEnabled)
			{
			iEnabled = iDopplerData.iEnabled;
			iObservers[0]->EffectChanged(this, (TUint8)MAudioEffectObserver::KEnabled);
			}
		else
			{
			iEnabled = iDopplerData.iEnabled;
			iObservers[0]->EffectChanged(this, (TUint8)MAudioEffectObserver::KDisabled);
			}

		}

	}


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



// End of File