diff -r ebdbd102c78a -r 2eacb6118286 phoneengine/audiohandling/src/cpeaudioeffect.cpp --- a/phoneengine/audiohandling/src/cpeaudioeffect.cpp Fri May 14 15:51:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2010 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: TMS AudioEffect. - * - */ - -#include -#include -#include -#include -#include -#include "cpeaudioeffect.h" -#include "pepanic.pan" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// Static constructor -// --------------------------------------------------------------------------- -// -CPEAudioEffect* CPEAudioEffect::NewL(TMSEffectObserver& aObserver) - { - CPEAudioEffect* self = CPEAudioEffect::NewLC(aObserver); - CleanupStack::Pop(self); - return self; - } - -// --------------------------------------------------------------------------- -// Static constructor -// --------------------------------------------------------------------------- -// -CPEAudioEffect* CPEAudioEffect::NewLC(TMSEffectObserver& aObserver) - { - CPEAudioEffect* self = new (ELeave) CPEAudioEffect(); - CleanupStack::PushL(self); - self->ConstructL(aObserver); - return self; - } - -// --------------------------------------------------------------------------- -// CPEAudioEffect::CPEAudioEffect -// --------------------------------------------------------------------------- -// -CPEAudioEffect::CPEAudioEffect() - { - } - -// --------------------------------------------------------------------------- -// Second phase constructor -// --------------------------------------------------------------------------- -// -void CPEAudioEffect::ConstructL(TMSEffectObserver& aObserver) - { - TMSVer* v = NULL; - TInt err(KErrNotFound); - TMSFactory::CreateFactory(iFactory, *v); - if (iFactory) - { - err = iFactory->CreateEffect(TMS_EFFECT_GLOBAL_GAIN, iGlobalGain); - err |= iFactory->CreateEffect(TMS_EFFECT_GLOBAL_VOL, iGlobalVol); - } - if (err) - { - User::Leave(KErrNotFound); - } - err = static_cast(iGlobalVol)->AddObserver(aObserver, - NULL); - User::LeaveIfError(err); - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CPEAudioEffect::~CPEAudioEffect() - { - iFactory->DeleteEffect(iGlobalGain); - iFactory->DeleteEffect(iGlobalVol); - delete iFactory; - } - -// --------------------------------------------------------------------------- -// CPEAudioEffect::SetMuteState(TBool aMute) -// --------------------------------------------------------------------------- -// -TInt CPEAudioEffect::SetMuteState(TBool aMute) - { - __ASSERT_DEBUG(iGlobalGain, Panic(EPEPanicBadHandle)); - guint value(0); - TInt err(KErrNotFound); - if (aMute) - { - err = static_cast(iGlobalGain)->SetLevel(0); - } - else - { - err = static_cast(iGlobalGain)->GetMaxLevel( - value); - if (err == TMS_RESULT_SUCCESS) - { - err = static_cast(iGlobalGain)->SetLevel( - value); - } - } - return err; - } - -// --------------------------------------------------------------------------- -// CPEAudioEffect::SetUnmuted -// --------------------------------------------------------------------------- -// -TBool CPEAudioEffect::MuteState() const - { - __ASSERT_DEBUG(iGlobalGain, Panic(EPEPanicBadHandle)); - guint value; - static_cast(iGlobalGain)->GetLevel(value); - return (value == 0) ? ETrue : EFalse; - } - -// --------------------------------------------------------------------------- -// CPEAudioEffect::SetVolume -// --------------------------------------------------------------------------- -// -void CPEAudioEffect::SetVolume(TInt aVolume) - { - __ASSERT_DEBUG(iGlobalVol, Panic(EPEPanicBadHandle)); - static_cast(iGlobalVol)->SetLevel(aVolume); - } - -// --------------------------------------------------------------------------- -// CPEAudioEffect::Volume -// --------------------------------------------------------------------------- -// -TInt CPEAudioEffect::Volume() const - { - __ASSERT_DEBUG(iGlobalVol, Panic(EPEPanicBadHandle)); - guint value(0); - static_cast(iGlobalVol)->GetLevel(value); - return value; - } - -// End of File