sl@0
|
1 |
|
sl@0
|
2 |
// MmfGlblAudioEffect.h
|
sl@0
|
3 |
|
sl@0
|
4 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
5 |
// All rights reserved.
|
sl@0
|
6 |
// This component and the accompanying materials are made available
|
sl@0
|
7 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
8 |
// which accompanies this distribution, and is available
|
sl@0
|
9 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Initial Contributors:
|
sl@0
|
12 |
// Nokia Corporation - initial contribution.
|
sl@0
|
13 |
//
|
sl@0
|
14 |
// Contributors:
|
sl@0
|
15 |
//
|
sl@0
|
16 |
// Description:
|
sl@0
|
17 |
//
|
sl@0
|
18 |
|
sl@0
|
19 |
#ifndef MMFGLBLAUDIOEFFECT_H
|
sl@0
|
20 |
#define MMFGLBLAUDIOEFFECT_H
|
sl@0
|
21 |
|
sl@0
|
22 |
#include <e32std.h>
|
sl@0
|
23 |
#include <e32base.h>
|
sl@0
|
24 |
#include <bamdesca.h>
|
sl@0
|
25 |
#include <mmf/common/mmfbase.hrh>
|
sl@0
|
26 |
|
sl@0
|
27 |
/**
|
sl@0
|
28 |
@publishedPartner
|
sl@0
|
29 |
@released
|
sl@0
|
30 |
@file
|
sl@0
|
31 |
*/
|
sl@0
|
32 |
|
sl@0
|
33 |
//forward decs
|
sl@0
|
34 |
class MMmfGlobalAudioImpl;
|
sl@0
|
35 |
class CMmfGlobalAudioEffect;
|
sl@0
|
36 |
class MMmfGlobalAudioPresetList;
|
sl@0
|
37 |
|
sl@0
|
38 |
/**
|
sl@0
|
39 |
Notify changes as requested
|
sl@0
|
40 |
*/
|
sl@0
|
41 |
class MMmfGlobalAudioEffectObserver
|
sl@0
|
42 |
{
|
sl@0
|
43 |
public:
|
sl@0
|
44 |
/**
|
sl@0
|
45 |
Callback that event is occuring, as requested.
|
sl@0
|
46 |
This pairs with CMmfGlobalAudioEffect::RequestNotificationL()
|
sl@0
|
47 |
@param aEffect
|
sl@0
|
48 |
The effect object from where the notification is being signaled
|
sl@0
|
49 |
@param aEventUid
|
sl@0
|
50 |
The uid passed to CMmfGlobalAudioEffect::RequestNotificationL()
|
sl@0
|
51 |
@param aParam
|
sl@0
|
52 |
Parameter data, exact use will depend on aEventUid
|
sl@0
|
53 |
@see CMmfGlobalAudioEffect::RequestNotificationL()
|
sl@0
|
54 |
*/
|
sl@0
|
55 |
virtual void GAEEventNotificationL(CMmfGlobalAudioEffect* aEffect, TUid aEventUid, const TDesC8& aParam)=0;
|
sl@0
|
56 |
};
|
sl@0
|
57 |
|
sl@0
|
58 |
/**
|
sl@0
|
59 |
EnableChanged event Uid
|
sl@0
|
60 |
@see CMmfGlobalAudioEffect::RequestNotificationL()
|
sl@0
|
61 |
*/
|
sl@0
|
62 |
const TUid KUidMmfGlblAudioEnableChanged = {KUidMmfGlblAudioEnableChangedDefine};
|
sl@0
|
63 |
|
sl@0
|
64 |
/**
|
sl@0
|
65 |
ActiveChanged event Uid
|
sl@0
|
66 |
@see CMmfGlobalAudioEffect::RequestNotificationL()
|
sl@0
|
67 |
*/
|
sl@0
|
68 |
const TUid KUidMmfGlblAudioActiveChanged = {KUidMmfGlblAudioActiveChangedDefine};
|
sl@0
|
69 |
|
sl@0
|
70 |
/**
|
sl@0
|
71 |
PresetsChanged event Uid
|
sl@0
|
72 |
@see CMmfGlobalAudioEffect::RequestNotificationL()
|
sl@0
|
73 |
*/
|
sl@0
|
74 |
const TUid KUidMmfGlblAudioPresetsChanged = {KUidMmfGlblAudioPresetsChangedDefine};
|
sl@0
|
75 |
|
sl@0
|
76 |
/**
|
sl@0
|
77 |
The value associated with the callback has been changed
|
sl@0
|
78 |
@see CMmfGlobalAudioEffect::RequestNotificationL()
|
sl@0
|
79 |
*/
|
sl@0
|
80 |
const TUid KUidMmfGlblAudioValueChanged = {KUidMmfGlblAudioValueChangedDefine};
|
sl@0
|
81 |
|
sl@0
|
82 |
|
sl@0
|
83 |
/**
|
sl@0
|
84 |
Parent class for global audio effects
|
sl@0
|
85 |
All global effect class derive from this class. It should be seen as an abstract class providing
|
sl@0
|
86 |
common facilities, that they all share. Users of these classes should be aware that there could
|
sl@0
|
87 |
be multiple instances, at any one go - e.g. in separate processes. All instances should use
|
sl@0
|
88 |
event notification (see RequestNotificationL()) to observe changes in values, in case another
|
sl@0
|
89 |
instance has changed things.
|
sl@0
|
90 |
If there is more than one output device on a phone, then the behaviour is system dependent,
|
sl@0
|
91 |
but typical behaviour would be for the settings etc only to apply to the current device -
|
sl@0
|
92 |
switching output device would lead to a direct change in the settings reported.
|
sl@0
|
93 |
*/
|
sl@0
|
94 |
class CMmfGlobalAudioEffect : public CBase
|
sl@0
|
95 |
{
|
sl@0
|
96 |
public:
|
sl@0
|
97 |
/**
|
sl@0
|
98 |
Destructor.
|
sl@0
|
99 |
*/
|
sl@0
|
100 |
IMPORT_C ~CMmfGlobalAudioEffect();
|
sl@0
|
101 |
|
sl@0
|
102 |
/**
|
sl@0
|
103 |
Flags denoting capability of specific global effect.
|
sl@0
|
104 |
These flags allow the client app to equire about the capabilities of the given effect.
|
sl@0
|
105 |
It should be noted that these refer to the specific implementation, and not
|
sl@0
|
106 |
necessarily the effect class
|
sl@0
|
107 |
*/
|
sl@0
|
108 |
enum TCapabilityFlags
|
sl@0
|
109 |
{
|
sl@0
|
110 |
ECapabilitySupportsInvidividualValues =0x0001, //*< Supports ExtractValuesL() and SetByValuesL()
|
sl@0
|
111 |
ECapabilitySupportsSettingByUid =0x0002, //*< Supports current setting to be requested by Uid
|
sl@0
|
112 |
ECapabilitySupportsSetSettingByUid =0x0004, //*< Supports current value to be changed by Uid
|
sl@0
|
113 |
ECapabilitySupportsSettingByDes =0x0008, //*< Supports current setting to be required by Descriptor
|
sl@0
|
114 |
ECapabilitySupportsSetSettingByDes =0x0010, //*< Supports current value to be changed by Descriptor
|
sl@0
|
115 |
ECapabilitySupportsActiveChangedCallback=0x0020, //*< Supports KUidMmfGlblAudioActiveChanged callbacks
|
sl@0
|
116 |
ECapabilitySupportsEnableChangedCallback=0x0040, //*< Supports KUidMmfGlblAudioEnableChanged callbacks
|
sl@0
|
117 |
ECapabilitySupportsPresetChangedCallback=0x0080, //*< Supports KUidMmfGlblAudioPresetsChanged callbacks
|
sl@0
|
118 |
};
|
sl@0
|
119 |
|
sl@0
|
120 |
/**
|
sl@0
|
121 |
Indication of how to interpret volume settings.
|
sl@0
|
122 |
*/
|
sl@0
|
123 |
enum TVolumeValue
|
sl@0
|
124 |
{
|
sl@0
|
125 |
EVolValueAbsolute, //*< Interpret volume and similar values as some form of absolute scale
|
sl@0
|
126 |
EVolValuedB //*< Interpret volume and similar values as dB
|
sl@0
|
127 |
};
|
sl@0
|
128 |
|
sl@0
|
129 |
/**
|
sl@0
|
130 |
Request capabilities of this object.
|
sl@0
|
131 |
Return the capabilities of the particular GlobalAudioEffect. If aCurrentOnly is false, then
|
sl@0
|
132 |
it will return all the possible features of the implementation, whereas if it is true only
|
sl@0
|
133 |
the features available at that moment are indicated. For example, an implementation may
|
sl@0
|
134 |
support returning the value by UID, but if it was set by UID. In such a circumstance, the
|
sl@0
|
135 |
bit will always be true if aCurrentOnly is false, but if aCurrentOnly is true and the
|
sl@0
|
136 |
value had been (say) set by descriptor, then that bit will be false.
|
sl@0
|
137 |
@param aCurrentOnly
|
sl@0
|
138 |
If true, capabilities are for current situation only - see text
|
sl@0
|
139 |
@return Capability settings, as given in TCapabilityFlags
|
sl@0
|
140 |
*/
|
sl@0
|
141 |
IMPORT_C TUint Capability(TBool aCurrentOnly);
|
sl@0
|
142 |
|
sl@0
|
143 |
/**
|
sl@0
|
144 |
Request to be told about particular events occuring
|
sl@0
|
145 |
This is a generic facility for providing callbacks as particular events occur. All callbacks
|
sl@0
|
146 |
are sent to the Observer that was passed on object creation, invoking GAEEventNotificationL().
|
sl@0
|
147 |
The following Uids are defined:
|
sl@0
|
148 |
|
sl@0
|
149 |
KUidMmfGlblAudioEnableChanged - Indicates the value of IsEnabled() has changed.
|
sl@0
|
150 |
KUidMmfGlblAudioActiveChanged - Indicates the value of IsActive() has changed.
|
sl@0
|
151 |
KUidMmfGlblAudioPresetsChanged - Indicates the list of known presets etc has been modified.
|
sl@0
|
152 |
KUidMmfGlblAudioValueChanged - Indicates the settings have been changed
|
sl@0
|
153 |
|
sl@0
|
154 |
With all these settings, the value of aParam returned to GAEEventNotificationL() will be empty.
|
sl@0
|
155 |
|
sl@0
|
156 |
@param aEventUid
|
sl@0
|
157 |
Uid specifying event for which notification is requested
|
sl@0
|
158 |
|
sl@0
|
159 |
@leave KErrNotSupported
|
sl@0
|
160 |
If Observer passed during construction was NULL.
|
sl@0
|
161 |
The Uid is not recognised.
|
sl@0
|
162 |
The feature is simply not supported in this implementation.
|
sl@0
|
163 |
@see MMmfGlobalAudioEffectObserver::GAEEventNotificationL()
|
sl@0
|
164 |
*/
|
sl@0
|
165 |
IMPORT_C void RequestNotificationL(TUid aEventUid);
|
sl@0
|
166 |
|
sl@0
|
167 |
/**
|
sl@0
|
168 |
The particular effect is enabled
|
sl@0
|
169 |
@return True if SetEnabledL(ETrue), or similar, has been called on this effect
|
sl@0
|
170 |
@see SetEnabledL()
|
sl@0
|
171 |
*/
|
sl@0
|
172 |
IMPORT_C TBool IsEnabled() const;
|
sl@0
|
173 |
|
sl@0
|
174 |
/**
|
sl@0
|
175 |
The particular effect is active
|
sl@0
|
176 |
Active is defined as being that the effect is in use - that is audio data is being played
|
sl@0
|
177 |
through it
|
sl@0
|
178 |
@return True if the effect is in use
|
sl@0
|
179 |
*/
|
sl@0
|
180 |
IMPORT_C TBool IsActive() const;
|
sl@0
|
181 |
|
sl@0
|
182 |
/**
|
sl@0
|
183 |
Enable (or disable) this effect
|
sl@0
|
184 |
If not enabled, the Effect will not change the data being passed through. However, the
|
sl@0
|
185 |
values associated with the effect. Where audio data is being played, the effect will
|
sl@0
|
186 |
take place immediately.
|
sl@0
|
187 |
@param aValue
|
sl@0
|
188 |
If true, enables this specific effect. If false, disables it.
|
sl@0
|
189 |
*/
|
sl@0
|
190 |
IMPORT_C void SetEnabledL(TBool aValue);
|
sl@0
|
191 |
|
sl@0
|
192 |
/**
|
sl@0
|
193 |
Obtain uid-based current settings
|
sl@0
|
194 |
If the value was set using SetSettingsByUidL() then this returns that setting. Note: can use
|
sl@0
|
195 |
Capability(ETrue) to avoid unnecessarily leave.
|
sl@0
|
196 |
@return The Uid used by SetSettingsByUidL()
|
sl@0
|
197 |
@leave KErrNotSupported
|
sl@0
|
198 |
The settings cannot be expressed as a Uid (usually means SetSettingsByUidL() was not the last
|
sl@0
|
199 |
thing to change them).
|
sl@0
|
200 |
*/
|
sl@0
|
201 |
IMPORT_C TUid SettingsByUidL() const;
|
sl@0
|
202 |
|
sl@0
|
203 |
/**
|
sl@0
|
204 |
Change settings by passing Uid
|
sl@0
|
205 |
Change the settings using a uid, that represents a preset. The uid could be known, but
|
sl@0
|
206 |
should preferably be obtained by using RequestPresets()
|
sl@0
|
207 |
@param aPresetUid
|
sl@0
|
208 |
Uid representing the preset in question
|
sl@0
|
209 |
@leave KErrNotSupported
|
sl@0
|
210 |
This implementation does not support presets for this effect
|
sl@0
|
211 |
@leave KErrUnknown
|
sl@0
|
212 |
The value of aUid does not correspond to a known preset
|
sl@0
|
213 |
@see RequestPresets()
|
sl@0
|
214 |
*/
|
sl@0
|
215 |
IMPORT_C void SetSettingsByUidL(TUid aPresetUid);
|
sl@0
|
216 |
|
sl@0
|
217 |
/**
|
sl@0
|
218 |
Obtain current settings by descriptor
|
sl@0
|
219 |
Return an HBufC8* representing the current settings. The format of this descriptor
|
sl@0
|
220 |
is not specified, but in any given implementation it must be usable by SetSettingsByDesL().
|
sl@0
|
221 |
Ownership of the descriptor is passed back to the calling code.
|
sl@0
|
222 |
@return HBufC8 containing current settings
|
sl@0
|
223 |
@leave KErrNotSupported
|
sl@0
|
224 |
This implementation does not support expressing settings in descriptor form
|
sl@0
|
225 |
@see SetSettingsByDesL()
|
sl@0
|
226 |
*/
|
sl@0
|
227 |
IMPORT_C HBufC8* SettingsByDesL() const;
|
sl@0
|
228 |
|
sl@0
|
229 |
/**
|
sl@0
|
230 |
Change settings by descriptor
|
sl@0
|
231 |
Update the current settings from values stored in a descriptor. The value in the
|
sl@0
|
232 |
descriptor will typically have been created using SettingsByDesL().
|
sl@0
|
233 |
@param aParam
|
sl@0
|
234 |
Descriptor value to use
|
sl@0
|
235 |
@leave KErrNotSupported
|
sl@0
|
236 |
This implementation does not support expressing settings in descriptor form
|
sl@0
|
237 |
@leave KErrCorrupt
|
sl@0
|
238 |
Value in descriptor does not correspond to known format
|
sl@0
|
239 |
*/
|
sl@0
|
240 |
IMPORT_C void SetSettingsByDesL(const TDesC8& aParam);
|
sl@0
|
241 |
|
sl@0
|
242 |
/**
|
sl@0
|
243 |
Return info about known presets by Uid
|
sl@0
|
244 |
This is used in connection with SetSettingsByUidL(). It allows the user to select a preset by
|
sl@0
|
245 |
name but this to be fed back as a Uid. It should also allow a Uid to be translated back to
|
sl@0
|
246 |
a name, if required. Ownership of the list itself remains within the effect implementation.
|
sl@0
|
247 |
The list may be changed on each call to KnownPresetsL() - users should be careful about
|
sl@0
|
248 |
caching the returned pointer.
|
sl@0
|
249 |
@return List of known preset names and uids
|
sl@0
|
250 |
@see SetSettingsByUidL()
|
sl@0
|
251 |
@leave KErrNotSupported
|
sl@0
|
252 |
This feature may not be supported in some circumstances
|
sl@0
|
253 |
*/
|
sl@0
|
254 |
IMPORT_C MMmfGlobalAudioPresetList* KnownPresetsL();
|
sl@0
|
255 |
|
sl@0
|
256 |
/**
|
sl@0
|
257 |
Extract the settings into a struct
|
sl@0
|
258 |
This extracts the current settings, and other data such as min/max values supported.
|
sl@0
|
259 |
This is intended to support direct selecting of values via graphical controls.
|
sl@0
|
260 |
Unlike SettingsByDesL(), the parameter is expected to be a package buffer wrapping a
|
sl@0
|
261 |
known class/struct, which will be defined by the particular derivation of this class.
|
sl@0
|
262 |
@param aPackageBuf
|
sl@0
|
263 |
This should be a package buffer wrapping the appropriate class/struct, and will be
|
sl@0
|
264 |
specific to a particular CMmfGlobalAudioEffect derivitive.
|
sl@0
|
265 |
@leave KErrNotSupported
|
sl@0
|
266 |
This will only be supported by some child classes, and even then will not
|
sl@0
|
267 |
be supported by all implementations.
|
sl@0
|
268 |
*/
|
sl@0
|
269 |
IMPORT_C void ExtractValuesL(TDes8& aPackageBuf);
|
sl@0
|
270 |
|
sl@0
|
271 |
/**
|
sl@0
|
272 |
Sets current settings from appropriate struct.
|
sl@0
|
273 |
This takes the same struct as used for ExtractValuesL() and changes the current settings.
|
sl@0
|
274 |
Typically it will be used at the end of a dialog to update the data.
|
sl@0
|
275 |
@param aPackageBuf
|
sl@0
|
276 |
This should be a package buffer wrapping the appropriate class/struct, and will be
|
sl@0
|
277 |
specific to a particular CMmfGlobalAudioEffect derivitive.
|
sl@0
|
278 |
@leave KErrNotSupported
|
sl@0
|
279 |
This will only be supported by some child classes, and even then will not
|
sl@0
|
280 |
be supported by all implementations.
|
sl@0
|
281 |
@leave KErrArgument
|
sl@0
|
282 |
Passed package buffer is not the expected size, or individual values are out of range
|
sl@0
|
283 |
*/
|
sl@0
|
284 |
IMPORT_C void SetByValuesL(const TDesC8& aPackageBuf);
|
sl@0
|
285 |
|
sl@0
|
286 |
protected:
|
sl@0
|
287 |
IMPORT_C CMmfGlobalAudioEffect();
|
sl@0
|
288 |
|
sl@0
|
289 |
/**
|
sl@0
|
290 |
Should be called in the ConstructL() of any derived type
|
sl@0
|
291 |
@param aImplementationUid
|
sl@0
|
292 |
Fixed for a given derived class, it is used to find the correct plugin or similar
|
sl@0
|
293 |
that implements that class.
|
sl@0
|
294 |
@param aObserver
|
sl@0
|
295 |
Observer class. Could be NULL, in which case RequestNotificationL() would not be supported
|
sl@0
|
296 |
@leave KErrNotSupported
|
sl@0
|
297 |
Cannot find implementation for given derived class
|
sl@0
|
298 |
*/
|
sl@0
|
299 |
IMPORT_C void BaseConstructL(TUid aImplementationUid, MMmfGlobalAudioEffectObserver* aObserver);
|
sl@0
|
300 |
|
sl@0
|
301 |
/**
|
sl@0
|
302 |
Request extension feature.
|
sl@0
|
303 |
This is intended to provide additional features, should a particular global effect
|
sl@0
|
304 |
need it. In typical use, the global effect will make a call to this interface on
|
sl@0
|
305 |
construction. Repeatedly calling this interface will have no additional effect -
|
sl@0
|
306 |
if the interface has already been setup internally, then no further activity will
|
sl@0
|
307 |
take place.
|
sl@0
|
308 |
@param aInterfaceUid
|
sl@0
|
309 |
Used to indicate which interface is required.
|
sl@0
|
310 |
@return Standard error code. KErrNotSupported is used to indicate that the particular
|
sl@0
|
311 |
plugin is used.
|
sl@0
|
312 |
*/
|
sl@0
|
313 |
IMPORT_C TInt CreateCustomInterface(TUid aInterfaceUid);
|
sl@0
|
314 |
|
sl@0
|
315 |
|
sl@0
|
316 |
/**
|
sl@0
|
317 |
Return previously created extension.
|
sl@0
|
318 |
This returns a custom interface, used to provide additional features for a certain
|
sl@0
|
319 |
global effect. This should only be used if CreateCustomInterface() has already
|
sl@0
|
320 |
been called for the same UID value. This means that any construction for that interface
|
sl@0
|
321 |
has already been called, and thus this call cannot fail. Typically the returned class
|
sl@0
|
322 |
will be another Mixin.No transfer of ownership is implied.
|
sl@0
|
323 |
|
sl@0
|
324 |
@param aInterfaceUid
|
sl@0
|
325 |
Used to indicate which interface is required.
|
sl@0
|
326 |
@return The requested interface, or NULL if not known.
|
sl@0
|
327 |
@see CreateCustomInterface()
|
sl@0
|
328 |
*/
|
sl@0
|
329 |
IMPORT_C TAny* CustomInterface(TUid aInterfaceUid);
|
sl@0
|
330 |
|
sl@0
|
331 |
private:
|
sl@0
|
332 |
MMmfGlobalAudioImpl* iBaseImplementation; //*< Implementation Object
|
sl@0
|
333 |
};
|
sl@0
|
334 |
|
sl@0
|
335 |
|
sl@0
|
336 |
/**
|
sl@0
|
337 |
List of preset names against their Uid
|
sl@0
|
338 |
Array of preset name and uid pairs. Returned by CMmfGlobalAudioEffect::KnownPresetsL()
|
sl@0
|
339 |
|
sl@0
|
340 |
@see CMmfGlobalAudioEffect::KnownPresetsL()
|
sl@0
|
341 |
*/
|
sl@0
|
342 |
class MMmfGlobalAudioPresetList : public MDesCArray
|
sl@0
|
343 |
{
|
sl@0
|
344 |
public:
|
sl@0
|
345 |
/**
|
sl@0
|
346 |
Return Uid corresponding to the name of the same index - the name being returned by
|
sl@0
|
347 |
McaPoint()
|
sl@0
|
348 |
@param aIndex
|
sl@0
|
349 |
Select element from list
|
sl@0
|
350 |
@return Uid of that element
|
sl@0
|
351 |
*/
|
sl@0
|
352 |
virtual TUid GAPUidPoint(TInt aIndex) const=0;
|
sl@0
|
353 |
};
|
sl@0
|
354 |
|
sl@0
|
355 |
|
sl@0
|
356 |
|
sl@0
|
357 |
#endif // MMFGLBLAUDIOEFFECT_H
|