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