os/mm/mmhais/a3facl/src/audiogaincontrol/logicalaudiogaincontrol.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:
    15 * Name        : logicalaudiogaincontrol.h
    16 * Part of     : ACL Logical Layer
    17 *
    18 */
    19 
    20 
    21 
    22 #ifndef LOGICALAUDIOGAINCONTROL_H
    23 #define LOGICALAUDIOGAINCONTROL_H
    24 
    25 #include <e32base.h>
    26 #include <a3f/a3f_trace_utils.h>
    27 #include <a3f/a3fbase.h>
    28 #include <a3f/maudiogaincontrol.h>
    29 #include <a3f/maudiogaincontrolobserver.h>
    30 
    31 #include "audioprocessingunit.h"
    32 
    33 
    34 class MLogicalSettingObserver;
    35 
    36 /**
    37 Implementation of audio gain control API.
    38 
    39 @lib audiogaincontrol.lib
    40 */
    41 
    42 NONSHARABLE_CLASS(CLogicalAudioGainControl) : 	public CAudioProcessingUnit,
    43 												public MAudioGainControl,
    44 												public MAudioGainControlObserver
    45 	{
    46 friend class CAudioContext;
    47 friend class CLogicalAudioStream;
    48 
    49 public:
    50 
    51 	/**
    52 	Destructor.
    53 
    54 	Deletes all objects and releases all resource owned by this instance.
    55 	*/
    56 	virtual ~CLogicalAudioGainControl();
    57 
    58 	// from base class MAudioGainControl
    59 	virtual TInt GetMaxGain(TInt& aMaxGain) const;
    60 	virtual TInt GetMaxRampTime(TTimeIntervalMicroSeconds& aMaxRampTime)const;
    61 	virtual TInt SetGain(RArray<TAudioChannelGain>& aChannels, TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration);
    62 	virtual TInt SetGain(RArray<TAudioChannelGain>& aChannels);
    63 	virtual TInt GetGain(RArray<TAudioChannelGain>& aChannels) const;
    64 	virtual TInt RegisterAudioGainControlObserver(MAudioGainControlObserver& aObserver);
    65 	virtual void UnregisterAudioGainControlObserver(MAudioGainControlObserver& aObserver);
    66 
    67 	// from base class CAudioProcessingUnit
    68 	virtual TBool IsTypeOf(TUid aTypeId) const;
    69 	virtual TAny* Interface(TUid aType);
    70 
    71 	// from base class MAudioGainControlObserver
    72 	void MaxRampTimeChanged(MAudioGainControl& aGain);
    73 	void MaxGainChanged(MAudioGainControl& aGain);
    74 	void GainChanged(MAudioGainControl& aGain, TInt aError);
    75 
    76 	/**
    77 	Create a new instance.
    78 
    79 	@param aGaincontrol the gain implementation. Ownership of the pointer
    80 			is transferred to the  create CAudioGainControl object instance.
    81 	@return CAudioGainControl* a pointer to the created instance.
    82 	*/
    83 	static CLogicalAudioGainControl* NewL(TAny* aParam);
    84 
    85 
    86 private:
    87 
    88 	void ConstructL();
    89 
    90 	CLogicalAudioGainControl(TAny* aParam);
    91 
    92 protected:
    93 	RArray<TAudioChannelGain> iActiveChannels;
    94 
    95 	RArray<TAudioChannelGain> iDesiredChannels;
    96 
    97 	TTimeIntervalMicroSeconds iDesiredRampTime;
    98 
    99 	TUid iDesiredRampOperation;
   100 
   101 private:
   102 	// Maximum value for ramp time
   103 	TTimeIntervalMicroSeconds iMaxRampTime;
   104 
   105 	// The adaptation gain control
   106 	MAudioGainControl* iAdaptationGain;
   107 
   108 	RPointerArray<MAudioGainControlObserver> iGainObservers;
   109 	};
   110 
   111 #endif // LOGICALAUDIOGAINCONTROL_H