|
1 /* |
|
2 * Copyright (c) 2005 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 settings of an audio effect called reverb. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CAMMSREVERBCONTROL_H |
|
20 #define CAMMSREVERBCONTROL_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <EnvironmentalReverbBase.h> |
|
25 #include <EnvironmentalReverbUtility.h> |
|
26 #include <CustomCommandUtility.h> |
|
27 #include "cammseffectcontrol.h" |
|
28 #include "cammsbasereverbcontrol.h" |
|
29 |
|
30 // CONSTANTS |
|
31 _LIT(KAMMSReverbControl, "ReverbControl"); |
|
32 _LIT(KAMMSDefaultReverbPreset, "smallroom"); |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * |
|
38 * Controls for the Reverb effect. |
|
39 * This class delegates Reverb effect method calls to CReverb. |
|
40 * |
|
41 * |
|
42 * @since 3.0 |
|
43 */ |
|
44 NONSHARABLE_CLASS(CAMMSReverbControl): public CAMMSBaseReverbControl |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 * @param aPlayer Player that has this control. |
|
51 */ |
|
52 static CAMMSReverbControl* NewLC(CMMAPlayer* aPlayer); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 ~CAMMSReverbControl(); |
|
58 |
|
59 public: // New functions |
|
60 |
|
61 /** |
|
62 * Sets the gain level of the reverberation. The value defines what is |
|
63 * the relative level of the first reflections compared to the sound |
|
64 * source without possible distance attenuations, directivities or |
|
65 * obstructions taken into account. |
|
66 * |
|
67 * @param aLevel The new level of the reverberation in millibels. |
|
68 * |
|
69 * @return The value that was actually set. |
|
70 * |
|
71 * @par Leaving: |
|
72 * @li \c KErrArgument - \a aLevel is greater than 0 |
|
73 */ |
|
74 TInt SetReverbLevelL(TInt aLevel); |
|
75 |
|
76 /** |
|
77 * Sets the reverberation time of the reverb. The reverberation time is |
|
78 * the time taken for the reverberant sound to attenuate by 60 dB from |
|
79 * its initial level. Typical values are in the range from 100 to 20000 |
|
80 * milliseconds. |
|
81 * The implementation might not support long reverberation times. |
|
82 * Therefore, the actual time used might be shorter than the time |
|
83 * specified with this method. |
|
84 * |
|
85 * @param aTime The new reverberation time in milliseconds. |
|
86 * |
|
87 * @return The value that was actually set. |
|
88 * |
|
89 * @par Leaving: |
|
90 * @li \c KErrArgument - \a aTime is negative. |
|
91 * From Java API more leave codes are: |
|
92 * - java.lang.IllegalArgumentException - when the given time is |
|
93 * negative |
|
94 * - javax.microedition.media.MediaException - when the changing of the |
|
95 * reverb time is not supported |
|
96 */ |
|
97 void SetReverbTimeL(TInt aTime); |
|
98 |
|
99 /** |
|
100 * Gets the gain level of the reverberation. |
|
101 * |
|
102 * @return The level of the reverberation in millibels. |
|
103 */ |
|
104 TInt ReverbLevel(); |
|
105 |
|
106 /** |
|
107 * Gets the reverberation time. |
|
108 * |
|
109 * @return The time of the reverberation in milliseconds. |
|
110 */ |
|
111 TInt ReverbTime(); |
|
112 |
|
113 /** |
|
114 * Gets the minimum level of the reverberation. |
|
115 * |
|
116 * @return The minimum level of the reverberation in millibels. |
|
117 */ |
|
118 TInt MinReverbLevel(); |
|
119 |
|
120 /** |
|
121 * Gets the maximum level of the reverberation. |
|
122 * |
|
123 * @return The maximum level of the reverberation in millibels. |
|
124 */ |
|
125 TInt MaxReverbLevel(); |
|
126 virtual TInt CurrentPresetIndex(); |
|
127 |
|
128 public: // Functions from base classes |
|
129 /** |
|
130 * Sets the effect according to the given preset. |
|
131 * |
|
132 * @param aPreset The new preset that will be taken into use. |
|
133 * |
|
134 * @par Leaving: |
|
135 * @li \c KErrArgument - \a aPreset is not available or it is null. |
|
136 */ |
|
137 void SetPresetL(const TDesC& aPreset); |
|
138 |
|
139 /** |
|
140 * Gets the available preset names. |
|
141 * |
|
142 * @return The names of all the available preset modes. |
|
143 */ |
|
144 const CDesCArray& PresetNamesL(); |
|
145 |
|
146 /** |
|
147 * Gets the current preset. |
|
148 * |
|
149 * @return The preset that is set at the moment. If none of the presets |
|
150 * is set, null will be returned. |
|
151 */ |
|
152 const TDesC& PresetL(); |
|
153 |
|
154 /** |
|
155 * Enables/disables the effect. |
|
156 * |
|
157 * @param aEnabled The boolean value, true=enabled, false=disabled. |
|
158 * |
|
159 * @par Leaving: |
|
160 * From Java API the leave codes are: |
|
161 * - java.lang.IllegalStateException - if the effect cannot be enabled |
|
162 * in this state of the player. |
|
163 * - javax.microedition.media.MediaException - if enabling is not |
|
164 * supported (with the scope set). |
|
165 */ |
|
166 void SetEnabledL(TBool aEnable); |
|
167 |
|
168 const TDesC& ClassName() const; |
|
169 |
|
170 /** |
|
171 * Prepares the Control. |
|
172 */ |
|
173 void PrepareControlL(); |
|
174 |
|
175 /** |
|
176 * Deallocates the Control. |
|
177 */ |
|
178 void DeallocateControl(); |
|
179 |
|
180 public: // Functions needed by reverb source control |
|
181 |
|
182 /** |
|
183 * Returns the environmental reverb utility. |
|
184 * ReverbSourceControl has to use the same instance. |
|
185 * The function creates the instance if they do not exist yet. |
|
186 * |
|
187 * @param aEnvironmentalReverbUtility Returned utility instance. |
|
188 */ |
|
189 void GetEnvironmentalReverbUtilityL( |
|
190 CEnvironmentalReverbUtility** aEnvironmentalReverbUtility); |
|
191 |
|
192 private: |
|
193 /** |
|
194 * C++ constructor. |
|
195 * @param aPlayer Player that has this control. |
|
196 */ |
|
197 CAMMSReverbControl(CMMAPlayer* aPlayer); |
|
198 |
|
199 /** |
|
200 * By default Symbian 2nd phase constructor is private. |
|
201 */ |
|
202 void ConstructL(); |
|
203 |
|
204 private: // Data |
|
205 |
|
206 /** Native reverb utility */ |
|
207 CEnvironmentalReverbUtility* iReverbUtility; |
|
208 |
|
209 /* Array for querying the preset names, owned */ |
|
210 CDesCArray* iPresetNames; |
|
211 |
|
212 /* Index of the current preset */ |
|
213 TInt iCurrentPreset; |
|
214 |
|
215 }; |
|
216 |
|
217 #endif // CAMMSREVERBCONTROL_H |
|
218 |
|
219 |