|
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: Group for effect controls |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CAMMSEFFECTCONTROLGROUP_H |
|
20 #define CAMMSEFFECTCONTROLGROUP_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <badesca.h> |
|
25 #include <mdaaudiosampleplayer.h> // MMdaAudioPlayerCallback |
|
26 #include "cammscontrolgroup.h" |
|
27 |
|
28 // CONSTANTS |
|
29 // Used to get preset names and data when the group is empty. |
|
30 _LIT(KAMMSEmptyGroupSoundPath, "Z:\\System\\Sounds\\Digital\\CamcorderJavaStart.wav"); |
|
31 const TInt KAMMSMaxPresetNameLength = 32; |
|
32 const TInt KAMMSPresetGranularity = 5; |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CAMMSEffectControl; |
|
36 |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
41 * Group for effect controls |
|
42 * |
|
43 * @since 3.0 |
|
44 */ |
|
45 NONSHARABLE_CLASS(CAMMSEffectControlGroup) |
|
46 : public CAMMSControlGroup, public MMdaAudioPlayerCallback |
|
47 { |
|
48 public: // Enumerations |
|
49 |
|
50 enum TEffectScope { |
|
51 EScopeLiveOnly = 1, |
|
52 EScopeRecordOnly = 2, |
|
53 EScopeLiveAndRecord = 3 }; |
|
54 |
|
55 public: // Constructors and destructor |
|
56 /** |
|
57 * Destructor. |
|
58 */ |
|
59 ~CAMMSEffectControlGroup(); |
|
60 |
|
61 public: // New functions |
|
62 |
|
63 /** |
|
64 * Gets the current preset. |
|
65 * |
|
66 * @return the current preset |
|
67 */ |
|
68 void GetPresetL(TDes& aPreset); |
|
69 |
|
70 /** |
|
71 * Gets the available preset names |
|
72 * |
|
73 * @return all the available current presets |
|
74 */ |
|
75 const CDesCArray& PresetNamesL(); |
|
76 |
|
77 /** |
|
78 * Returns the scope in which the effect is present. |
|
79 * |
|
80 * @return SCOPE_LIVE_ONLY, SCOPE_RECORD_ONLY or SCOPE_LIVE_AND_RECORD |
|
81 */ |
|
82 TEffectScope Scope(); |
|
83 |
|
84 /** |
|
85 * Returns true if the effect is enabled and false otherwise. |
|
86 * |
|
87 * @return true=enable, false=disable |
|
88 */ |
|
89 TBool Enabled(); |
|
90 |
|
91 /** |
|
92 * Returns the current enforced setting of the effect. |
|
93 * |
|
94 * @return true if the effect is an enforced effect, false if not |
|
95 */ |
|
96 TBool Enforced(); |
|
97 |
|
98 /** |
|
99 * Enables/disables the effect. |
|
100 * |
|
101 * @param aEnabled true=enabled, false=disabled |
|
102 */ |
|
103 void SetEnabledL(TBool aEnabled); |
|
104 |
|
105 /** |
|
106 * Enforces the effect to be in use. |
|
107 * |
|
108 * @param aEnforced true if the effect is essential and cannot |
|
109 * be dropped, false if the effect can be dropped |
|
110 * if the system runs out of resources. |
|
111 */ |
|
112 void SetEnforcedL(TBool aEnforced); |
|
113 |
|
114 /** |
|
115 * Sets the effect according to the given preset. |
|
116 * |
|
117 * @param aPreset The new preset that will be taken into use |
|
118 */ |
|
119 void SetPresetL(const TDesC& aPreset); |
|
120 |
|
121 /** |
|
122 * Sets the scope of the effect. |
|
123 * |
|
124 * @param aScope SCOPE_LIVE_ONLY, SCOPE_RECORD_ONLY or |
|
125 * SCOPE_LIVE_AND_RECORD. |
|
126 */ |
|
127 void SetScopeL(TEffectScope aScope); |
|
128 |
|
129 public: // From MMdaAudioPlayerCallback |
|
130 |
|
131 /** |
|
132 * Called when file KAMMSEmptyGroupSoundPath has been opened. |
|
133 */ |
|
134 void MapcInitComplete(TInt aError, |
|
135 const TTimeIntervalMicroSeconds& aDuration); |
|
136 |
|
137 /** |
|
138 * Called when KAMMSEmptyGroupSoundPath has been played, |
|
139 * no implementation needed in this class. |
|
140 */ |
|
141 void MapcPlayComplete(TInt aError); |
|
142 |
|
143 private: // New functions |
|
144 /** |
|
145 * Gets control. Ownership is not tranferred. |
|
146 * |
|
147 * @param aIndex Control index. |
|
148 */ |
|
149 CAMMSEffectControl* TypeSafeControl(TInt aIndex) const; |
|
150 |
|
151 protected: // New functions |
|
152 /** |
|
153 * Called by when a new player is added |
|
154 * |
|
155 * @param aPlayer The player being added |
|
156 * @param aControl The player's control relevant to this group |
|
157 */ |
|
158 void NotifyPlayerAddedL(CMMAPlayer* aPlayer, CMMAControl* aControl); |
|
159 |
|
160 /** |
|
161 * Called when the current preset changes |
|
162 */ |
|
163 virtual void PresetChangedL(); |
|
164 |
|
165 /* |
|
166 * Finish initialization (after the 1st player is added) |
|
167 */ |
|
168 virtual void InitializeL(); |
|
169 |
|
170 /** |
|
171 * Creates utilities that can be used to obtain preset names |
|
172 * and preset data (needed when the group has no controls). |
|
173 * Does nothing if the utility already exists. |
|
174 */ |
|
175 virtual void PrepareEmptyGroupUtilitiesL(); |
|
176 |
|
177 /** |
|
178 * Deletes utilities that are used to obtain preset names |
|
179 * and preset data (needed when the group has no controls). |
|
180 * Does nothing if the utilities have already been deleted. |
|
181 */ |
|
182 virtual void DeleteEmptyGroupUtilities(); |
|
183 |
|
184 /** |
|
185 * Gets list of preset names available. |
|
186 * @param aPresetNames Returned preset names |
|
187 */ |
|
188 virtual void GetPresetNamesL(CDesCArray& aPresetNames) = 0; |
|
189 |
|
190 protected: |
|
191 /** |
|
192 * C++ default constructor. |
|
193 */ |
|
194 CAMMSEffectControlGroup(const TDesC& aName); |
|
195 |
|
196 protected: |
|
197 /** |
|
198 * 2nd phase constructor. |
|
199 */ |
|
200 void BaseConstructL(); |
|
201 |
|
202 protected: // data |
|
203 |
|
204 // Available preset names, owned |
|
205 CDesCArrayFlat* iPresetNames; |
|
206 |
|
207 // Index of the current preset or -1 if no preset is set |
|
208 TInt iPresetIndex; |
|
209 |
|
210 TBool iInitialized; // Flag to store whether effect is initialized |
|
211 |
|
212 // Used to get preset names and data when the group is empty |
|
213 // (there are no controls in the group, and thus, no actual |
|
214 // control can be used for that purpose). |
|
215 CMdaAudioPlayerUtility* iEmptyPlayerUtility; // Owned. |
|
216 |
|
217 private: //data |
|
218 |
|
219 TEffectScope iScope; // Scope of the effect |
|
220 TBool iEnabled; // Flag to store whether effect is enabled |
|
221 TBool iEnforced; // Flag to store whether effect is enforced |
|
222 |
|
223 // Flag to store whether enforce was set before the group was initialized |
|
224 TBool iInitialEnforceSet; |
|
225 // Flag to store whether scope was set before the group was initialized |
|
226 TBool iInitialScopeSet; |
|
227 |
|
228 // Used to wait for opening KAMMSEmptyGroupSoundPath. |
|
229 CActiveSchedulerWait* iActiveSchedulerWait; // Owned. |
|
230 |
|
231 // Error code occured when creating a player for empty group. |
|
232 TInt iEmptyPlayerUtilityError; |
|
233 |
|
234 }; |
|
235 |
|
236 #endif // CAMMSEFFECTCONTROLGROUP_H |
|
237 |
|
238 |