diff -r 2a40e88564c8 -r 4e84c994a771 mpserviceplugins/inc/mpxaudioeffectproperties.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpserviceplugins/inc/mpxaudioeffectproperties.inl Fri Mar 19 09:28:13 2010 +0200 @@ -0,0 +1,279 @@ +/* +* 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: Inline implementation of audio effect properties +* +*/ + +#include +#include +#include +#include + +_LIT( KMPXAudioEffectFileName, "c:\\system\\data\\mpxaudioeffect.dat" ); + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +inline CMPXAudioEffectProperties::~CMPXAudioEffectProperties() + { + //iDesValues.DeleteAll(); + } + + +// ----------------------------------------------------------------------------- +// Return balance +// ----------------------------------------------------------------------------- +// +inline TInt CMPXAudioEffectProperties::Balance() const + { + return Value(EIntBalance); + } + +// ----------------------------------------------------------------------------- +// Set balance +// ----------------------------------------------------------------------------- +// +inline void CMPXAudioEffectProperties::SetBalance(TInt aBalance) + { + SetValue(EIntBalance, aBalance); + } + +// ----------------------------------------------------------------------------- +// Reverb value +// ----------------------------------------------------------------------------- +// +inline TInt CMPXAudioEffectProperties::Reverb() const + { + return Value(EIntReverb); + } + +// ----------------------------------------------------------------------------- +// Set reverb +// ----------------------------------------------------------------------------- +// +inline void CMPXAudioEffectProperties::SetReverb(TInt aReverb) + { + SetValue(EIntReverb, aReverb); + } + +// ----------------------------------------------------------------------------- +// Stereo value +// ----------------------------------------------------------------------------- +// +inline TBool CMPXAudioEffectProperties::Stereo() const + { + return Value(EIntStereo); + } + +// ----------------------------------------------------------------------------- +// Set bass boost +// ----------------------------------------------------------------------------- +// +inline void CMPXAudioEffectProperties::SetStereo(TBool aStereo) + { + SetValue(EIntStereo, aStereo); + } + +// ----------------------------------------------------------------------------- +// Bass boost value +// ----------------------------------------------------------------------------- +// +inline TBool CMPXAudioEffectProperties::BassBoost() const + { + return Value(EIntBassBoost); + } + +// ----------------------------------------------------------------------------- +// Set bass boost +// ----------------------------------------------------------------------------- +// +inline void CMPXAudioEffectProperties::SetBassBoost(TBool aBassBoost) + { + SetValue(EIntBassBoost, aBassBoost); + } + +// ----------------------------------------------------------------------------- +// Bass boost value +// ----------------------------------------------------------------------------- +// +inline TBool CMPXAudioEffectProperties::Loudness() const + { + return Value(EIntLoudness); + } + +// ----------------------------------------------------------------------------- +// Set loudness +// ----------------------------------------------------------------------------- +// +inline void CMPXAudioEffectProperties::SetLoudness(TBool aLoudness) + { + SetValue(EIntLoudness, aLoudness); + } + +// ----------------------------------------------------------------------------- +// Externalize properties +// ----------------------------------------------------------------------------- +// +inline void CMPXAudioEffectProperties::ExternalizeL(RWriteStream& aStream) const + { + MPX_DEBUG1("CMPXAudioEffectProperties::ExternalizeL <---"); + for (TInt i=0;i(ii)).Length()); + // aStream << Value(static_cast(ii)); + // } + MPX_DEBUG1("CMPXAudioEffectProperties::ExternalizeL --->"); + } + +// ----------------------------------------------------------------------------- +// Internalize properties +// ----------------------------------------------------------------------------- +// +inline void CMPXAudioEffectProperties::InternalizeL(RReadStream& aStream) + { + MPX_DEBUG1("CMPXAudioEffectProperties::InternalizeL <---"); + for (TInt i=0;i"); + } + +// ----------------------------------------------------------------------------- +// Get value of a descriptor property +// ----------------------------------------------------------------------------- +// +inline const TDesC& CMPXAudioEffectProperties::Value(TDesProperty /*aProperty*/) const + { + //return iDesValues[aProperty] ? + // static_cast(*iDesValues[aProperty]) : KNullDesC; + return KNullDesC; + } + +// ----------------------------------------------------------------------------- +// Get value of an integer property +// ----------------------------------------------------------------------------- +// +inline TInt CMPXAudioEffectProperties::Value(TIntProperty aProperty) const + { + return iIntValues[aProperty]; + } + +// ----------------------------------------------------------------------------- +// Set value of a descriptor property +// ----------------------------------------------------------------------------- +// +inline void CMPXAudioEffectProperties::SetValue(TDesProperty /*aProperty*/, + const TDesC& /*aValue*/) + { + //delete iDesValues[aProperty]; + //iDesValues[aProperty]=aValue.Alloc(); + } + +// ----------------------------------------------------------------------------- +// Set value of an integer property +// ----------------------------------------------------------------------------- +// +inline void CMPXAudioEffectProperties::SetValue(TIntProperty aProperty,TInt aValue) + { + iIntValues[aProperty]=aValue; + } + +// ----------------------------------------------------------------------------- +// Reset all values to 0 or NULL +// ----------------------------------------------------------------------------- +// +inline void CMPXAudioEffectProperties::Reset() + { + MPX_DEBUG1("CMPXAudioEffectProperties::Reset"); + for (TInt i=0;iSetTypeL( KDirectFileStoreLayoutUid ); + RStoreWriteStream stream; + TStreamId id = stream.CreateLC( *store ); + this->ExternalizeL(stream); + stream.CommitL(); + CleanupStack::PopAndDestroy(); + store->SetRootL( id ); + store->CommitL(); + CleanupStack::PopAndDestroy(); + CleanupStack::PopAndDestroy(&fs); + MPX_DEBUG1("CMPXAudioEffectProperties::SaveToFileL --->"); + } + +// ----------------------------------------------------------------------------- +// Load from file +// ----------------------------------------------------------------------------- +// +inline void CMPXAudioEffectProperties::LoadFromFileL() + { + MPX_DEBUG1("CMPXAudioEffectProperties::LoadFromFileL <---"); + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL(fs); + fs.MkDirAll( KMPXAudioEffectFileName ); + TParse parsedName; + + fs.Parse( KMPXAudioEffectFileName, parsedName ); + CFileStore* store = CDirectFileStore::OpenLC(fs, + parsedName.FullName(), + EFileRead ); + RStoreReadStream stream; + stream.OpenLC( *store, store->Root() ); + this->InternalizeL(stream); + CleanupStack::PopAndDestroy(); //store + CleanupStack::PopAndDestroy(); //stream + CleanupStack::PopAndDestroy(&fs); + MPX_DEBUG1("CMPXAudioEffectProperties::LoadFromFileL --->"); + } +