1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mm_pub/audio_effects_api/inc/AudioEqualizerBase.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,309 @@
1.4 +/*
1.5 +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description: This is the definition of the Audio Equalizer effect class.
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#ifndef CAUDIOEQUALIZER_H
1.23 +#define CAUDIOEQUALIZER_H
1.24 +
1.25 +// INCLUDES
1.26 +
1.27 +#include <e32base.h>
1.28 +#include <AudioEffectBase.h>
1.29 +#include <AudioEqualizerData.h>
1.30 +#include <MCustomInterface.h>
1.31 +
1.32 +
1.33 +const TUid KUidAudioEqualizerEffect = {0x1020382A};
1.34 +
1.35 +// FORWARD DELCARATION
1.36 +class CMdaAudioConvertUtility;
1.37 +class CMdaAudioPlayerUtility;
1.38 +class CMdaAudioRecorderUtility;
1.39 +class CMdaAudioInputStream;
1.40 +class CMdaAudioOutputStream;
1.41 +class CMdaAudioToneUtility;
1.42 +class CCustomCommandUtility;
1.43 +class CCustomInterfaceUtility;
1.44 +class CMMFDevSound;
1.45 +class CMidiClientUtility;
1.46 +class CDrmPlayerUtility;
1.47 +class CVideoPlayerUtility;
1.48 +
1.49 +// CLASS DECLARATION
1.50 +
1.51 +/**
1.52 +* This is the Equalizer effect class for managing audio equalizer settings.
1.53 +*
1.54 +* @lib AudioEqualizerEffect.lib
1.55 +* @since 3.0
1.56 +*/
1.57 +
1.58 +class CAudioEqualizer : public CAudioEffect
1.59 + {
1.60 +
1.61 + public: //New Functions
1.62 +
1.63 + /**
1.64 + * Factory function for creating the audio equalizer object.
1.65 + * @since 3.0
1.66 + * @return pointer to CAudioEqualizer object
1.67 + */
1.68 + IMPORT_C static CAudioEqualizer* NewL();
1.69 +
1.70 + /**
1.71 + * Factory function for creating the audio equalizer object.
1.72 + * @since 3.0
1.73 + * @param aUtility A reference to a convert utility
1.74 + * @return pointer to CAudioEqualizer object
1.75 + */
1.76 + IMPORT_C static CAudioEqualizer* NewL( CMdaAudioConvertUtility& aUtility );
1.77 +
1.78 + /**
1.79 + * Factory function for creating the audio equalizer object.
1.80 + * @since 3.0
1.81 + * @param aUtility A reference to an audio input stream utility
1.82 + * @return pointer to CAudioEqualizer object
1.83 + */
1.84 + IMPORT_C static CAudioEqualizer* NewL( CMdaAudioInputStream& aUtility );
1.85 +
1.86 + /**
1.87 + * Factory function for creating the audio equalizer object.
1.88 + * @since 3.0
1.89 + * @param aUtility A reference to an audio output stream utility
1.90 + * @return pointer to CAudioEqualizer object
1.91 + */
1.92 + IMPORT_C static CAudioEqualizer* NewL( CMdaAudioOutputStream& aUtility );
1.93 +
1.94 + /**
1.95 + * Factory function for creating the audio equalizer object.
1.96 + * @since 3.0
1.97 + * @param aUtility A reference to an audio player utility
1.98 + * @return pointer to CAudioEqualizer object
1.99 + */
1.100 + IMPORT_C static CAudioEqualizer* NewL( CMdaAudioPlayerUtility& aUtility );
1.101 +
1.102 + /**
1.103 + * Factory function for creating the audio equalizer object.
1.104 + * @since 3.0
1.105 + * @param aUtility A reference to an audio record utility
1.106 + * @param aRecordStream ETrue if the effect is to be applied to the recording,
1.107 + * EFalse if the effect is to be applied only to the playback
1.108 + * @return pointer to CAudioEqualizer object
1.109 + */
1.110 + IMPORT_C static CAudioEqualizer* NewL( CMdaAudioRecorderUtility& aUtility, TBool aRecordStream );
1.111 +
1.112 + /**
1.113 + * Factory function for creating the audio equalizer object.
1.114 + * @since 3.0
1.115 + * @param aUtility A reference to an audio tone utility
1.116 + * @return pointer to CAudioEqualizer object
1.117 + */
1.118 + IMPORT_C static CAudioEqualizer* NewL( CMdaAudioToneUtility& aUtility );
1.119 +
1.120 + /**
1.121 + * Factory function for creating the audio equalizer object.
1.122 + * @since 3.0
1.123 + * @param aDevSound A reference to a DevSound instance
1.124 + * @return pointer to CAudioEqualizer object
1.125 + */
1.126 + IMPORT_C static CAudioEqualizer* NewL( CMMFDevSound& aDevSound );
1.127 +
1.128 + /**
1.129 + * Factory function for creating the audio equalizer object.
1.130 + * @since 3.0
1.131 + * @param aUtility A reference to a custom command utility
1.132 + * @return pointer to CAudioEqualizer object
1.133 + */
1.134 + IMPORT_C static CAudioEqualizer* NewL( CCustomCommandUtility* aUtility );
1.135 +
1.136 + /**
1.137 + * Factory function for creating the audio equalizer object.
1.138 + * @since 3.0
1.139 + * @param aCustomInterface A reference to a custom interface
1.140 + * @return pointer to CAudioEqualizer object
1.141 + */
1.142 + IMPORT_C static CAudioEqualizer* NewL( MCustomInterface& aCustomInterface );
1.143 +
1.144 +
1.145 + /**
1.146 + * Factory function for creating the audio equalizer object.
1.147 + * @since 3.0
1.148 + * @param CMidiClientUtility A reference to a CMidiClientUtility object
1.149 + * @return pointer to CAudioEqualizer object
1.150 + */
1.151 + IMPORT_C static CAudioEqualizer* NewL( CMidiClientUtility& aUtility );
1.152 +
1.153 + /**
1.154 + * Factory function for creating the audio equalizer object.
1.155 + * @since 3.0
1.156 + * @param CDrmPlayerUtility A reference to a CDrmPlayerUtility object
1.157 + * @return pointer to CAudioEqualizer object
1.158 + */
1.159 + IMPORT_C static CAudioEqualizer* NewL( CDrmPlayerUtility& aUtility );
1.160 +
1.161 + /**
1.162 + * Factory function for creating the audio equalizer object.
1.163 + * @since 3.2
1.164 + * @param CVideoPlayerUtility A reference to a CVideoPlayerUtility object
1.165 + * @return pointer to CAudioEqualizer object
1.166 + */
1.167 + IMPORT_C static CAudioEqualizer* NewL( CVideoPlayerUtility& aUtility );
1.168 +
1.169 + /**
1.170 + *
1.171 + * Destructor
1.172 + */
1.173 + IMPORT_C virtual ~CAudioEqualizer();
1.174 +
1.175 + /**
1.176 + * Get the band level in mB for the specified band
1.177 + * @since 3.0
1.178 + * @param aBand Frequency Band
1.179 + * @return Returns the band level in mB for the specified band
1.180 + */
1.181 + IMPORT_C TInt32 BandLevel( TUint8 aBand ) const;
1.182 +
1.183 + /**
1.184 + * Get the band width in Hz for the specified band.
1.185 + * @since 3.0
1.186 + * @param aBand Frequency Band
1.187 + * @return The band width in Hz for the specified band
1.188 + */
1.189 + IMPORT_C TInt32 BandWidth( TUint8 aBand ) const;
1.190 +
1.191 + /**
1.192 + * Get the center frequency in Hz for a given band
1.193 + * @since 3.0
1.194 + * @param aBand Frequency Band
1.195 + * @return The center frequency in Hz for a given band.
1.196 + */
1.197 + IMPORT_C TInt32 CenterFrequency( TUint8 aBand ) const;
1.198 +
1.199 + /**
1.200 + * Get the cross-over frequency between the given frequency band (aBand) and the next band
1.201 + * @since 3.0
1.202 + * @param aBand Frequency Band
1.203 + * @return Crossover frequency.
1.204 + */
1.205 + IMPORT_C TInt32 CrossoverFrequency( TUint8 aBand ) const;
1.206 +
1.207 + /**
1.208 + * Get the dB range in mB for the equalizer
1.209 + * @since 3.0
1.210 + * @param aMin Minimum level in dB
1.211 + * @param aMin Maximum level in dB
1.212 + */
1.213 + IMPORT_C void DbLevelLimits( TInt32& aMin, TInt32& aMax );
1.214 +
1.215 + /**
1.216 + * Get number of equalizer bands.
1.217 + * @since 3.0
1.218 + * @param -
1.219 + * @return The number of equalizer bands.
1.220 + */
1.221 + IMPORT_C TUint8 NumberOfBands() const;
1.222 +
1.223 + /**
1.224 + * Sets the equalizer band level value in mB, ranging from Min to Max
1.225 + * @since 3.0
1.226 + * @param aBand Frequency Band
1.227 + * @param aLevel band level in dB, ranges from DbLevelLimits()
1.228 + * @return -
1.229 + */
1.230 + IMPORT_C void SetBandLevelL( TInt8 aBand, TInt32 aLevel );
1.231 +
1.232 + public: // functions from base class
1.233 +
1.234 + /*
1.235 + * From CAudioEffect
1.236 + * Get the unique identifier of the audio effect
1.237 + * @since 3.0
1.238 + * @return Unique identifier
1.239 + */
1.240 + IMPORT_C TUid Uid() const;
1.241 +
1.242 +
1.243 + protected: // Functions from base classes
1.244 +
1.245 + /**
1.246 + * From CAudioEffect
1.247 + * Create a package of the effect data
1.248 + * @since 3.0
1.249 + * @return A descriptor containing the effect data.
1.250 + */
1.251 + IMPORT_C const TDesC8& DoEffectData();
1.252 +
1.253 + /**
1.254 + * From CAudioEffect
1.255 + * Internal function to unpack effect data
1.256 + * @since 3.0
1.257 + * @param aEffectDataBuffer Descriptor containing packed effect data
1.258 + * @return -
1.259 + */
1.260 + IMPORT_C void SetEffectData( const TDesC8& aEffectDataBuffer );
1.261 +
1.262 + protected:
1.263 +
1.264 + /**
1.265 + * Private C++ constructor for this class.
1.266 + * @since 3.0
1.267 + * @return -
1.268 + */
1.269 + IMPORT_C CAudioEqualizer();
1.270 +
1.271 + /**
1.272 + * Create a descriptor containing data for the specified band(s).
1.273 + * @since 3.0
1.274 + * @param aBand The frequency band data to package. Valid if aAllBands = EFalse.
1.275 + * @param aAllBands Indicate if data for all bands is requested.
1.276 + * @return A descriptor containing data for specified band.
1.277 + */
1.278 + IMPORT_C const TDesC8& DoBandDataL( TUint8 aBand, TBool aAllBands );
1.279 +
1.280 + /**
1.281 + * Unpack band data from the specified descriptor.
1.282 + * @since 3.0
1.283 + * @param aNumberOfBands Number of bands contained in the descriptor.
1.284 + * @param aBandDataBuffer Descriptor containing band data
1.285 + */
1.286 + IMPORT_C void SetBandDataL( TInt aNumberOfBands, const TDesC8& aBandDataBuffer );
1.287 +
1.288 + protected:
1.289 +
1.290 + // Equalizer data structure
1.291 + TEfAudioEqualizer iAudioEqualizerData;
1.292 + // Equalizer Band data structure
1.293 + RArray<TEfAudioEqualizerBand> iBandsData;
1.294 + // Data package sent to server
1.295 + TEfAudioEqualizerDataPckg iDataPckgTo;
1.296 + // Band Data package sent to server
1.297 + TEfAudioEqualizerBandDataPckg iBandDataPckgTo;
1.298 + // Bitmask used to indicate change in band data
1.299 + TUint32 iBandChange;
1.300 +
1.301 + HBufC8* iBandDataBuf;
1.302 +
1.303 + protected: // Friend classes
1.304 +
1.305 + friend class CAudioEqualizerMessageHandler;
1.306 + friend class CAudioEqualizerUtility;
1.307 +
1.308 + };
1.309 +
1.310 +#endif // of CAUDIOEQUALIZER_H
1.311 +
1.312 +// End of File