|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Manipulates the equalization settings of a Player. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CAMMSEQUALIZERCONTROL_H |
|
20 #define CAMMSEQUALIZERCONTROL_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <AudioEqualizerBase.h> |
|
25 #include <AudioEqualizerUtility.h> |
|
26 #include <CustomCommandUtility.h> |
|
27 #include "cammsbaseequalizercontrol.h" |
|
28 |
|
29 // CONSTANTS |
|
30 _LIT(KAMMSEqualizerControl, "EqualizerControl"); |
|
31 |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * |
|
37 * Controls for the Equalizer effect. |
|
38 * This class delegates Equalizer effect method calls to CAudioEqualizer. |
|
39 * |
|
40 * |
|
41 * @since 3.0 |
|
42 */ |
|
43 NONSHARABLE_CLASS(CAMMSEqualizerControl): public CAMMSBaseEqualizerControl |
|
44 { |
|
45 public: |
|
46 /** |
|
47 * Two-phased constructor. |
|
48 * @param aPlayer Player that has this control. |
|
49 */ |
|
50 static CAMMSEqualizerControl* NewLC(CMMAPlayer* aPlayer); |
|
51 |
|
52 /** |
|
53 * Destructor. |
|
54 */ |
|
55 ~CAMMSEqualizerControl(); |
|
56 |
|
57 public: // New functions |
|
58 |
|
59 /** |
|
60 * Gets the gain set for the given equalizer band. |
|
61 * |
|
62 * @param aBand The frequency band whose gain is asked. The numbering of |
|
63 * the bands starts from 0 and ends at (getNumberOfBands() - 1). |
|
64 * |
|
65 * @return The gain set for the given band in millibels. |
|
66 * |
|
67 * @par Leaving: |
|
68 * @li \c KErrArgument - \a aBand is out of range. |
|
69 */ |
|
70 TInt BandLevelL(TInt aBand); |
|
71 |
|
72 /** |
|
73 * Returns the maximum band level supported. |
|
74 * |
|
75 * @return The maximum band level in millibels. |
|
76 */ |
|
77 TInt MaxBandLevel(); |
|
78 |
|
79 /** |
|
80 * Returns the minimum band level supported. |
|
81 * |
|
82 * @return The minimum band level in millibels. |
|
83 */ |
|
84 TInt MinBandLevel(); |
|
85 |
|
86 /** |
|
87 * Returns the band width in Hz for the specified band. |
|
88 * |
|
89 * @param aBand The frequency band whose band width is asked. |
|
90 * The numbering of the bands starts from 0 and ends at |
|
91 * (getNumberOfBands() - 1). |
|
92 * |
|
93 * @return The band width in Hz for the specified band. |
|
94 */ |
|
95 TInt BandWidth(TInt aBand); |
|
96 |
|
97 /** |
|
98 * Returns the center frequency in Hz for a given band. |
|
99 * |
|
100 * @param aBand The frequency band whose center frequency |
|
101 * is asked. The numbering of |
|
102 * the bands starts from 0 and ends at (getNumberOfBands() - 1). |
|
103 * |
|
104 * @return The center frequency in Hz for a given band. |
|
105 */ |
|
106 TInt CenterFrequency(TInt aBand); |
|
107 |
|
108 /** |
|
109 * Returns the cross-over frequency between the given frequency |
|
110 * band (aBand) and the next band. |
|
111 * |
|
112 * @param aBand The frequency band whose gain is asked. The numbering of |
|
113 * the bands starts from 0 and ends at (getNumberOfBands() - 1). |
|
114 * |
|
115 * @return Crossover frequency. |
|
116 */ |
|
117 TInt CrossoverFrequency(TInt aBand); |
|
118 |
|
119 /** |
|
120 * Gets the number of frequency bands that the equalizer supports. |
|
121 * |
|
122 * @return The number of frequency bands that the equalizer supports. |
|
123 */ |
|
124 TInt NumberOfBands(); |
|
125 |
|
126 /** |
|
127 * Sets the given equalizer band to the given gain value. |
|
128 * |
|
129 * @param aLevel The new gain in millibels that will be set to the given |
|
130 * band. getMinBandLevel() and getMaxBandLevel() will define the maximum |
|
131 * and minimum values. |
|
132 * @param aBand The frequency band that will have the new gain. The |
|
133 * numbering of the bands starts from 0 and ends at |
|
134 * (getNumberOfBands() - 1). |
|
135 * |
|
136 * @par Leaving: |
|
137 * @li \c KErrArgument - \a aBand or \a aLevel is out of range. |
|
138 */ |
|
139 void SetBandLevelL(TInt aLevel, TInt aBand); |
|
140 |
|
141 public: // Functions from base classes |
|
142 |
|
143 /** |
|
144 * Sets the effect according to the given preset. |
|
145 * |
|
146 * @param aPreset The new preset that will be taken into use. |
|
147 * |
|
148 * @par Leaving: |
|
149 * @li \c KErrArgument - \a aPreset is not available or it is null. |
|
150 */ |
|
151 void SetPresetL(const TDesC& aPreset); |
|
152 |
|
153 /** |
|
154 * Gets the available preset names. |
|
155 * |
|
156 * @return The names of all the available preset modes. |
|
157 */ |
|
158 const CDesCArray& PresetNamesL(); |
|
159 |
|
160 /** |
|
161 * Gets the current preset. |
|
162 * |
|
163 * @return The preset that is set at the moment. If none of the presets |
|
164 * is set, null will be returned. |
|
165 */ |
|
166 const TDesC& PresetL(); |
|
167 |
|
168 /** |
|
169 * Enables/disables the effect. |
|
170 * |
|
171 * @param aEnabled The boolean value, true=enabled, false=disabled. |
|
172 * |
|
173 * @par Leaving: |
|
174 * From Java API the leave codes are: |
|
175 * - java.lang.IllegalStateException - if the effect cannot be enabled |
|
176 * in this state of the player. |
|
177 * - javax.microedition.media.MediaException - if enabling is not |
|
178 * supported (with the scope set). |
|
179 */ |
|
180 void SetEnabledL(TBool aEnable); |
|
181 |
|
182 const TDesC& ClassName() const; |
|
183 |
|
184 /** |
|
185 * Prepares the Control. |
|
186 */ |
|
187 void PrepareControlL(); |
|
188 |
|
189 /** |
|
190 * Deallocates the Control. |
|
191 */ |
|
192 void DeallocateControl(); |
|
193 |
|
194 private: |
|
195 /** |
|
196 * C++ constructor. |
|
197 * @param aPlayer Player that has this control. |
|
198 */ |
|
199 CAMMSEqualizerControl(CMMAPlayer* aPlayer); |
|
200 |
|
201 /** |
|
202 * By default Symbian 2nd phase constructor is private. |
|
203 */ |
|
204 void ConstructL(); |
|
205 |
|
206 private: // Data |
|
207 |
|
208 /** Native audio equalizer */ |
|
209 CAudioEqualizerUtility* iEqualizerUtility; |
|
210 |
|
211 /* Array for querying the preset names, owned */ |
|
212 CDesCArray* iPresetNames; |
|
213 |
|
214 /* Index of the current preset */ |
|
215 TInt iCurrentPreset; |
|
216 |
|
217 }; |
|
218 |
|
219 #endif // CAMMSEQUALIZERCONTROL_H |
|
220 |
|
221 |