author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
parent 2 | 2fe1408b6811 |
permissions | -rw-r--r-- |
williamr@2 | 1 |
/* |
williamr@2 | 2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
williamr@2 | 3 |
* All rights reserved. |
williamr@2 | 4 |
* This component and the accompanying materials are made available |
williamr@4 | 5 |
* under the terms of "Eclipse Public License v1.0" |
williamr@2 | 6 |
* which accompanies this distribution, and is available |
williamr@4 | 7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
williamr@2 | 8 |
* |
williamr@2 | 9 |
* Initial Contributors: |
williamr@2 | 10 |
* Nokia Corporation - initial contribution. |
williamr@2 | 11 |
* |
williamr@2 | 12 |
* Contributors: |
williamr@2 | 13 |
* |
williamr@2 | 14 |
* Description: This is the definition of the Audio Equalizer effect class. |
williamr@2 | 15 |
* |
williamr@2 | 16 |
*/ |
williamr@2 | 17 |
|
williamr@2 | 18 |
|
williamr@2 | 19 |
#ifndef CAUDIOEQUALIZER_H |
williamr@2 | 20 |
#define CAUDIOEQUALIZER_H |
williamr@2 | 21 |
|
williamr@2 | 22 |
// INCLUDES |
williamr@2 | 23 |
|
williamr@2 | 24 |
#include <e32base.h> |
williamr@2 | 25 |
#include <AudioEffectBase.h> |
williamr@2 | 26 |
#include <AudioEqualizerData.h> |
williamr@2 | 27 |
#include <MCustomInterface.h> |
williamr@2 | 28 |
|
williamr@2 | 29 |
|
williamr@2 | 30 |
const TUid KUidAudioEqualizerEffect = {0x1020382A}; |
williamr@2 | 31 |
|
williamr@2 | 32 |
// FORWARD DELCARATION |
williamr@2 | 33 |
class CMdaAudioConvertUtility; |
williamr@2 | 34 |
class CMdaAudioPlayerUtility; |
williamr@2 | 35 |
class CMdaAudioRecorderUtility; |
williamr@2 | 36 |
class CMdaAudioInputStream; |
williamr@2 | 37 |
class CMdaAudioOutputStream; |
williamr@2 | 38 |
class CMdaAudioToneUtility; |
williamr@2 | 39 |
class CCustomCommandUtility; |
williamr@2 | 40 |
class CCustomInterfaceUtility; |
williamr@2 | 41 |
class CMMFDevSound; |
williamr@2 | 42 |
class CMidiClientUtility; |
williamr@2 | 43 |
class CDrmPlayerUtility; |
williamr@2 | 44 |
class CVideoPlayerUtility; |
williamr@2 | 45 |
|
williamr@2 | 46 |
// CLASS DECLARATION |
williamr@2 | 47 |
|
williamr@2 | 48 |
/** |
williamr@2 | 49 |
* This is the Equalizer effect class for managing audio equalizer settings. |
williamr@2 | 50 |
* |
williamr@2 | 51 |
* @lib AudioEqualizerEffect.lib |
williamr@2 | 52 |
* @since 3.0 |
williamr@2 | 53 |
*/ |
williamr@2 | 54 |
|
williamr@2 | 55 |
class CAudioEqualizer : public CAudioEffect |
williamr@2 | 56 |
{ |
williamr@2 | 57 |
|
williamr@2 | 58 |
public: //New Functions |
williamr@2 | 59 |
|
williamr@2 | 60 |
/** |
williamr@2 | 61 |
* Factory function for creating the audio equalizer object. |
williamr@2 | 62 |
* @since 3.0 |
williamr@2 | 63 |
* @return pointer to CAudioEqualizer object |
williamr@2 | 64 |
*/ |
williamr@2 | 65 |
IMPORT_C static CAudioEqualizer* NewL(); |
williamr@2 | 66 |
|
williamr@2 | 67 |
/** |
williamr@2 | 68 |
* Factory function for creating the audio equalizer object. |
williamr@2 | 69 |
* @since 3.0 |
williamr@2 | 70 |
* @param aUtility A reference to a convert utility |
williamr@2 | 71 |
* @return pointer to CAudioEqualizer object |
williamr@2 | 72 |
*/ |
williamr@2 | 73 |
IMPORT_C static CAudioEqualizer* NewL( CMdaAudioConvertUtility& aUtility ); |
williamr@2 | 74 |
|
williamr@2 | 75 |
/** |
williamr@2 | 76 |
* Factory function for creating the audio equalizer object. |
williamr@2 | 77 |
* @since 3.0 |
williamr@2 | 78 |
* @param aUtility A reference to an audio input stream utility |
williamr@2 | 79 |
* @return pointer to CAudioEqualizer object |
williamr@2 | 80 |
*/ |
williamr@2 | 81 |
IMPORT_C static CAudioEqualizer* NewL( CMdaAudioInputStream& aUtility ); |
williamr@2 | 82 |
|
williamr@2 | 83 |
/** |
williamr@2 | 84 |
* Factory function for creating the audio equalizer object. |
williamr@2 | 85 |
* @since 3.0 |
williamr@2 | 86 |
* @param aUtility A reference to an audio output stream utility |
williamr@2 | 87 |
* @return pointer to CAudioEqualizer object |
williamr@2 | 88 |
*/ |
williamr@2 | 89 |
IMPORT_C static CAudioEqualizer* NewL( CMdaAudioOutputStream& aUtility ); |
williamr@2 | 90 |
|
williamr@2 | 91 |
/** |
williamr@2 | 92 |
* Factory function for creating the audio equalizer object. |
williamr@2 | 93 |
* @since 3.0 |
williamr@2 | 94 |
* @param aUtility A reference to an audio player utility |
williamr@2 | 95 |
* @return pointer to CAudioEqualizer object |
williamr@2 | 96 |
*/ |
williamr@2 | 97 |
IMPORT_C static CAudioEqualizer* NewL( CMdaAudioPlayerUtility& aUtility ); |
williamr@2 | 98 |
|
williamr@2 | 99 |
/** |
williamr@2 | 100 |
* Factory function for creating the audio equalizer object. |
williamr@2 | 101 |
* @since 3.0 |
williamr@2 | 102 |
* @param aUtility A reference to an audio record utility |
williamr@2 | 103 |
* @param aRecordStream ETrue if the effect is to be applied to the recording, |
williamr@2 | 104 |
* EFalse if the effect is to be applied only to the playback |
williamr@2 | 105 |
* @return pointer to CAudioEqualizer object |
williamr@2 | 106 |
*/ |
williamr@2 | 107 |
IMPORT_C static CAudioEqualizer* NewL( CMdaAudioRecorderUtility& aUtility, TBool aRecordStream ); |
williamr@2 | 108 |
|
williamr@2 | 109 |
/** |
williamr@2 | 110 |
* Factory function for creating the audio equalizer object. |
williamr@2 | 111 |
* @since 3.0 |
williamr@2 | 112 |
* @param aUtility A reference to an audio tone utility |
williamr@2 | 113 |
* @return pointer to CAudioEqualizer object |
williamr@2 | 114 |
*/ |
williamr@2 | 115 |
IMPORT_C static CAudioEqualizer* NewL( CMdaAudioToneUtility& aUtility ); |
williamr@2 | 116 |
|
williamr@2 | 117 |
/** |
williamr@2 | 118 |
* Factory function for creating the audio equalizer object. |
williamr@2 | 119 |
* @since 3.0 |
williamr@2 | 120 |
* @param aDevSound A reference to a DevSound instance |
williamr@2 | 121 |
* @return pointer to CAudioEqualizer object |
williamr@2 | 122 |
*/ |
williamr@2 | 123 |
IMPORT_C static CAudioEqualizer* NewL( CMMFDevSound& aDevSound ); |
williamr@2 | 124 |
|
williamr@2 | 125 |
/** |
williamr@2 | 126 |
* Factory function for creating the audio equalizer object. |
williamr@2 | 127 |
* @since 3.0 |
williamr@2 | 128 |
* @param aUtility A reference to a custom command utility |
williamr@2 | 129 |
* @return pointer to CAudioEqualizer object |
williamr@2 | 130 |
*/ |
williamr@2 | 131 |
IMPORT_C static CAudioEqualizer* NewL( CCustomCommandUtility* aUtility ); |
williamr@2 | 132 |
|
williamr@2 | 133 |
/** |
williamr@2 | 134 |
* Factory function for creating the audio equalizer object. |
williamr@2 | 135 |
* @since 3.0 |
williamr@2 | 136 |
* @param aCustomInterface A reference to a custom interface |
williamr@2 | 137 |
* @return pointer to CAudioEqualizer object |
williamr@2 | 138 |
*/ |
williamr@2 | 139 |
IMPORT_C static CAudioEqualizer* NewL( MCustomInterface& aCustomInterface ); |
williamr@2 | 140 |
|
williamr@2 | 141 |
|
williamr@2 | 142 |
/** |
williamr@2 | 143 |
* Factory function for creating the audio equalizer object. |
williamr@2 | 144 |
* @since 3.0 |
williamr@2 | 145 |
* @param CMidiClientUtility A reference to a CMidiClientUtility object |
williamr@2 | 146 |
* @return pointer to CAudioEqualizer object |
williamr@2 | 147 |
*/ |
williamr@2 | 148 |
IMPORT_C static CAudioEqualizer* NewL( CMidiClientUtility& aUtility ); |
williamr@2 | 149 |
|
williamr@2 | 150 |
/** |
williamr@2 | 151 |
* Factory function for creating the audio equalizer object. |
williamr@2 | 152 |
* @since 3.0 |
williamr@2 | 153 |
* @param CDrmPlayerUtility A reference to a CDrmPlayerUtility object |
williamr@2 | 154 |
* @return pointer to CAudioEqualizer object |
williamr@2 | 155 |
*/ |
williamr@2 | 156 |
IMPORT_C static CAudioEqualizer* NewL( CDrmPlayerUtility& aUtility ); |
williamr@2 | 157 |
|
williamr@2 | 158 |
/** |
williamr@2 | 159 |
* Factory function for creating the audio equalizer object. |
williamr@2 | 160 |
* @since 3.2 |
williamr@2 | 161 |
* @param CVideoPlayerUtility A reference to a CVideoPlayerUtility object |
williamr@2 | 162 |
* @return pointer to CAudioEqualizer object |
williamr@2 | 163 |
*/ |
williamr@2 | 164 |
IMPORT_C static CAudioEqualizer* NewL( CVideoPlayerUtility& aUtility ); |
williamr@2 | 165 |
|
williamr@2 | 166 |
/** |
williamr@2 | 167 |
* |
williamr@2 | 168 |
* Destructor |
williamr@2 | 169 |
*/ |
williamr@2 | 170 |
IMPORT_C virtual ~CAudioEqualizer(); |
williamr@2 | 171 |
|
williamr@2 | 172 |
/** |
williamr@2 | 173 |
* Get the band level in mB for the specified band |
williamr@2 | 174 |
* @since 3.0 |
williamr@2 | 175 |
* @param aBand Frequency Band |
williamr@2 | 176 |
* @return Returns the band level in mB for the specified band |
williamr@2 | 177 |
*/ |
williamr@2 | 178 |
IMPORT_C TInt32 BandLevel( TUint8 aBand ) const; |
williamr@2 | 179 |
|
williamr@2 | 180 |
/** |
williamr@2 | 181 |
* Get the band width in Hz for the specified band. |
williamr@2 | 182 |
* @since 3.0 |
williamr@2 | 183 |
* @param aBand Frequency Band |
williamr@2 | 184 |
* @return The band width in Hz for the specified band |
williamr@2 | 185 |
*/ |
williamr@2 | 186 |
IMPORT_C TInt32 BandWidth( TUint8 aBand ) const; |
williamr@2 | 187 |
|
williamr@2 | 188 |
/** |
williamr@2 | 189 |
* Get the center frequency in Hz for a given band |
williamr@2 | 190 |
* @since 3.0 |
williamr@2 | 191 |
* @param aBand Frequency Band |
williamr@2 | 192 |
* @return The center frequency in Hz for a given band. |
williamr@2 | 193 |
*/ |
williamr@2 | 194 |
IMPORT_C TInt32 CenterFrequency( TUint8 aBand ) const; |
williamr@2 | 195 |
|
williamr@2 | 196 |
/** |
williamr@2 | 197 |
* Get the cross-over frequency between the given frequency band (aBand) and the next band |
williamr@2 | 198 |
* @since 3.0 |
williamr@2 | 199 |
* @param aBand Frequency Band |
williamr@2 | 200 |
* @return Crossover frequency. |
williamr@2 | 201 |
*/ |
williamr@2 | 202 |
IMPORT_C TInt32 CrossoverFrequency( TUint8 aBand ) const; |
williamr@2 | 203 |
|
williamr@2 | 204 |
/** |
williamr@2 | 205 |
* Get the dB range in mB for the equalizer |
williamr@2 | 206 |
* @since 3.0 |
williamr@2 | 207 |
* @param aMin Minimum level in dB |
williamr@2 | 208 |
* @param aMin Maximum level in dB |
williamr@2 | 209 |
*/ |
williamr@2 | 210 |
IMPORT_C void DbLevelLimits( TInt32& aMin, TInt32& aMax ); |
williamr@2 | 211 |
|
williamr@2 | 212 |
/** |
williamr@2 | 213 |
* Get number of equalizer bands. |
williamr@2 | 214 |
* @since 3.0 |
williamr@2 | 215 |
* @param - |
williamr@2 | 216 |
* @return The number of equalizer bands. |
williamr@2 | 217 |
*/ |
williamr@2 | 218 |
IMPORT_C TUint8 NumberOfBands() const; |
williamr@2 | 219 |
|
williamr@2 | 220 |
/** |
williamr@2 | 221 |
* Sets the equalizer band level value in mB, ranging from Min to Max |
williamr@2 | 222 |
* @since 3.0 |
williamr@2 | 223 |
* @param aBand Frequency Band |
williamr@2 | 224 |
* @param aLevel band level in dB, ranges from DbLevelLimits() |
williamr@2 | 225 |
* @return - |
williamr@2 | 226 |
*/ |
williamr@2 | 227 |
IMPORT_C void SetBandLevelL( TInt8 aBand, TInt32 aLevel ); |
williamr@2 | 228 |
|
williamr@2 | 229 |
public: // functions from base class |
williamr@2 | 230 |
|
williamr@2 | 231 |
/* |
williamr@2 | 232 |
* From CAudioEffect |
williamr@2 | 233 |
* Get the unique identifier of the audio effect |
williamr@2 | 234 |
* @since 3.0 |
williamr@2 | 235 |
* @return Unique identifier |
williamr@2 | 236 |
*/ |
williamr@2 | 237 |
IMPORT_C TUid Uid() const; |
williamr@2 | 238 |
|
williamr@2 | 239 |
|
williamr@2 | 240 |
protected: // Functions from base classes |
williamr@2 | 241 |
|
williamr@2 | 242 |
/** |
williamr@2 | 243 |
* From CAudioEffect |
williamr@2 | 244 |
* Create a package of the effect data |
williamr@2 | 245 |
* @since 3.0 |
williamr@2 | 246 |
* @return A descriptor containing the effect data. |
williamr@2 | 247 |
*/ |
williamr@2 | 248 |
IMPORT_C const TDesC8& DoEffectData(); |
williamr@2 | 249 |
|
williamr@2 | 250 |
/** |
williamr@2 | 251 |
* From CAudioEffect |
williamr@2 | 252 |
* Internal function to unpack effect data |
williamr@2 | 253 |
* @since 3.0 |
williamr@2 | 254 |
* @param aEffectDataBuffer Descriptor containing packed effect data |
williamr@2 | 255 |
* @return - |
williamr@2 | 256 |
*/ |
williamr@2 | 257 |
IMPORT_C void SetEffectData( const TDesC8& aEffectDataBuffer ); |
williamr@2 | 258 |
|
williamr@2 | 259 |
protected: |
williamr@2 | 260 |
|
williamr@2 | 261 |
/** |
williamr@2 | 262 |
* Private C++ constructor for this class. |
williamr@2 | 263 |
* @since 3.0 |
williamr@2 | 264 |
* @return - |
williamr@2 | 265 |
*/ |
williamr@2 | 266 |
IMPORT_C CAudioEqualizer(); |
williamr@2 | 267 |
|
williamr@2 | 268 |
/** |
williamr@2 | 269 |
* Create a descriptor containing data for the specified band(s). |
williamr@2 | 270 |
* @since 3.0 |
williamr@2 | 271 |
* @param aBand The frequency band data to package. Valid if aAllBands = EFalse. |
williamr@2 | 272 |
* @param aAllBands Indicate if data for all bands is requested. |
williamr@2 | 273 |
* @return A descriptor containing data for specified band. |
williamr@2 | 274 |
*/ |
williamr@2 | 275 |
IMPORT_C const TDesC8& DoBandDataL( TUint8 aBand, TBool aAllBands ); |
williamr@2 | 276 |
|
williamr@2 | 277 |
/** |
williamr@2 | 278 |
* Unpack band data from the specified descriptor. |
williamr@2 | 279 |
* @since 3.0 |
williamr@2 | 280 |
* @param aNumberOfBands Number of bands contained in the descriptor. |
williamr@2 | 281 |
* @param aBandDataBuffer Descriptor containing band data |
williamr@2 | 282 |
*/ |
williamr@2 | 283 |
IMPORT_C void SetBandDataL( TInt aNumberOfBands, const TDesC8& aBandDataBuffer ); |
williamr@2 | 284 |
|
williamr@2 | 285 |
protected: |
williamr@2 | 286 |
|
williamr@2 | 287 |
// Equalizer data structure |
williamr@2 | 288 |
TEfAudioEqualizer iAudioEqualizerData; |
williamr@2 | 289 |
// Equalizer Band data structure |
williamr@2 | 290 |
RArray<TEfAudioEqualizerBand> iBandsData; |
williamr@2 | 291 |
// Data package sent to server |
williamr@2 | 292 |
TEfAudioEqualizerDataPckg iDataPckgTo; |
williamr@2 | 293 |
// Band Data package sent to server |
williamr@2 | 294 |
TEfAudioEqualizerBandDataPckg iBandDataPckgTo; |
williamr@2 | 295 |
// Bitmask used to indicate change in band data |
williamr@2 | 296 |
TUint32 iBandChange; |
williamr@2 | 297 |
|
williamr@2 | 298 |
HBufC8* iBandDataBuf; |
williamr@2 | 299 |
|
williamr@2 | 300 |
protected: // Friend classes |
williamr@2 | 301 |
|
williamr@2 | 302 |
friend class CAudioEqualizerMessageHandler; |
williamr@2 | 303 |
friend class CAudioEqualizerUtility; |
williamr@2 | 304 |
|
williamr@2 | 305 |
}; |
williamr@2 | 306 |
|
williamr@2 | 307 |
#endif // of CAUDIOEQUALIZER_H |
williamr@2 | 308 |
|
williamr@2 | 309 |
// End of File |