diff -r 000000000000 -r bde4ae8d615e os/mm/mmhais/refacladapt/src/audiogaincontrol/audiogaincontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os/mm/mmhais/refacladapt/src/audiogaincontrol/audiogaincontrol.h Fri Jun 15 03:10:57 2012 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2007-2009 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: +* +*/ + + + +#ifndef AUDIOGAINCONTROL_H +#define AUDIOGAINCONTROL_H + +#include +#include +#include +#include + +#include "mgainhelper.h" + +#include + + +const TUint KDefaultGain = 5; +const TUint KDefaultMaxGain = 255; // TODO should discover at run time but this is value of current Symbian sound driver adaptor +const TUint KDefaultNumChannels = 2; +const TUint KDefaultMaxRampTime = 5; + +enum TGainControlPanicCode + { + EAdaptationOldSetGainCalledPanic, + }; + +/** + * Implementation of audio gain control API. + * ?more_complete_description + * @lib audiogaincontrol.lib + */ +NONSHARABLE_CLASS(CAudioGainControl) : public CBase, public MAudioGainControl + { +public: + + IMPORT_C static CAudioGainControl* NewL(); + /** + * Destructor. + * + * Deletes all objects and releases all resource owned by this instance. + */ + virtual ~CAudioGainControl(); + + IMPORT_C void SetHelper(MGainHelper& aHelper); + + IMPORT_C void IssueGainChangedCallBack(TInt aError); + + IMPORT_C TInt ConfigureRamp(TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration); + + void IssueMaxGainChangedCallBack(); + void IssueMaxRampTimeChangedCallBack(); + + // from base class MAudioGainControl + TInt GetMaxGain(TInt& aMaxGain) const; + TInt GetMaxRampTime(TTimeIntervalMicroSeconds& aMaxRampTime) const; + TInt SetGain(RArray& aChannels, TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration); + TInt SetGain(RArray& aChannels); + TInt GetGain(RArray& aChannels) const; + TInt RegisterAudioGainControlObserver(MAudioGainControlObserver& aObserver); + void UnregisterAudioGainControlObserver(MAudioGainControlObserver& aObserver); + +private: + void ConstructL(); + + CAudioGainControl(); + +private: //data + RArray iGains; + /** + * Reference to observer instance + */ + RPointerArray iGainObservers; + + // The gain cannot talk directly with the sound device driver so it needs a helper to request + MGainHelper* iHelper; + }; + +#endif // AUDIOGAINCONTROL_H