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