sl@0: /* sl@0: * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: #ifndef AUDIOGAINCONTROL_H sl@0: #define AUDIOGAINCONTROL_H sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #include "mgainhelper.h" sl@0: sl@0: #include sl@0: sl@0: sl@0: const TUint KDefaultGain = 5; sl@0: const TUint KDefaultMaxGain = 255; // TODO should discover at run time but this is value of current Symbian sound driver adaptor sl@0: const TUint KDefaultNumChannels = 2; sl@0: const TUint KDefaultMaxRampTime = 5; sl@0: sl@0: enum TGainControlPanicCode sl@0: { sl@0: EAdaptationOldSetGainCalledPanic, sl@0: }; sl@0: sl@0: /** sl@0: * Implementation of audio gain control API. sl@0: * ?more_complete_description sl@0: * @lib audiogaincontrol.lib sl@0: */ sl@0: NONSHARABLE_CLASS(CAudioGainControl) : public CBase, public MAudioGainControl sl@0: { sl@0: public: sl@0: sl@0: IMPORT_C static CAudioGainControl* NewL(); sl@0: /** sl@0: * Destructor. sl@0: * sl@0: * Deletes all objects and releases all resource owned by this instance. sl@0: */ sl@0: virtual ~CAudioGainControl(); sl@0: sl@0: IMPORT_C void SetHelper(MGainHelper& aHelper); sl@0: sl@0: IMPORT_C void IssueGainChangedCallBack(TInt aError); sl@0: sl@0: IMPORT_C TInt ConfigureRamp(TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration); sl@0: sl@0: void IssueMaxGainChangedCallBack(); sl@0: void IssueMaxRampTimeChangedCallBack(); sl@0: sl@0: // from base class MAudioGainControl sl@0: TInt GetMaxGain(TInt& aMaxGain) const; sl@0: TInt GetMaxRampTime(TTimeIntervalMicroSeconds& aMaxRampTime) const; sl@0: TInt SetGain(RArray& aChannels, TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration); sl@0: TInt SetGain(RArray& aChannels); sl@0: TInt GetGain(RArray& aChannels) const; sl@0: TInt RegisterAudioGainControlObserver(MAudioGainControlObserver& aObserver); sl@0: void UnregisterAudioGainControlObserver(MAudioGainControlObserver& aObserver); sl@0: sl@0: private: sl@0: void ConstructL(); sl@0: sl@0: CAudioGainControl(); sl@0: sl@0: private: //data sl@0: RArray iGains; sl@0: /** sl@0: * Reference to observer instance sl@0: */ sl@0: RPointerArray iGainObservers; sl@0: sl@0: // The gain cannot talk directly with the sound device driver so it needs a helper to request sl@0: MGainHelper* iHelper; sl@0: }; sl@0: sl@0: #endif // AUDIOGAINCONTROL_H