2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: This is the definition of the Stereo Widening effect class.
19 #ifndef CSTEREOWIDENING_H
20 #define CSTEREOWIDENING_H
25 #include <AudioEffectBase.h>
26 #include <StereoWideningData.h>
27 #include <MCustomInterface.h>
29 const TUid KUidStereoWideningEffect = {0x10203836};
31 // FORWARD DELCARATION
32 class CMdaAudioConvertUtility;
33 class CMdaAudioPlayerUtility;
34 class CMdaAudioRecorderUtility;
35 class CMdaAudioInputStream;
36 class CMdaAudioOutputStream;
37 class CMdaAudioToneUtility;
38 class CCustomCommandUtility;
39 class CCustomInterfaceUtility;
41 class CMidiClientUtility;
42 class CDrmPlayerUtility;
43 class CVideoPlayerUtility;
48 * This is the Stereo Widening effect class for managing audio Stereo Widening settings.
50 * @lib StereoWidening.lib
54 class CStereoWidening : public CAudioEffect
57 public: //New Functions
60 * Factory function for creating the stereo widening object.
62 * @return pointer to CStereoWidening object
64 IMPORT_C static CStereoWidening* NewL();
67 * Factory function for creating the stereo widening object.
69 * @param aUtility A reference to a convert utility
70 * @param aEnable Indicate whether the effect will be automatically enabled after creation.
71 * @param aInitialLevel Initial value of stereo widening to be used when aEnable = ETrue
72 * @return pointer to CStereoWidening object
74 IMPORT_C static CStereoWidening* NewL(CMdaAudioConvertUtility& aUtility,
75 TBool aEnable = EFalse,
76 TInt8 aInitialLevel = 0);
79 * Factory function for creating the stereo widening object.
81 * @param aUtility A reference to an audio input stream utility
82 * @param aEnable Indicate whether the effect will be automatically enabled after creation.
83 * @param aInitialLevel Initial value of stereo widening to be used when aEnable = ETrue
84 * @return pointer to CStereoWidening object
86 IMPORT_C static CStereoWidening* NewL(CMdaAudioInputStream& aUtility,
87 TBool aEnable = EFalse,
88 TInt8 aInitialLevel = 0);
91 * Factory function for creating the stereo widening object.
93 * @param aUtility A reference to an audio output stream utility
94 * @param aEnable Indicate whether the effect will be automatically enabled after creation.
95 * @param aInitialLevel Initial value of stereo widening to be used when aEnable = ETrue
96 * @return pointer to CStereoWidening object
98 IMPORT_C static CStereoWidening* NewL(CMdaAudioOutputStream& aUtility,
99 TBool aEnable = EFalse,
100 TInt8 aInitialLevel = 0);
103 * Factory function for creating the stereo widening object.
105 * @param aUtility A reference to an audio player utility
106 * @param aEnable Indicate whether the effect will be automatically enabled after creation.
107 * @param aInitialLevel Initial value of stereo widening to be used when aEnable = ETrue
108 * @return pointer to CStereoWidening object
110 IMPORT_C static CStereoWidening* NewL(CMdaAudioPlayerUtility& aUtility,
111 TBool aEnable = EFalse,
112 TInt8 aInitialLevel = 0);
115 * Factory function for creating the stereo widening object.
117 * @param aUtility A reference to an audio record utility
118 * @param aRecordStream ETrue if the effect is to be applied to the recording,
119 * EFalse if the effect is to be applied only to the playback
120 * @param aEnable Indicate whether the effect will be automatically enabled after creation.
121 * @param aInitialLevel Initial value of stereo widening to be used when aEnable = ETrue
122 * @return pointer to CStereoWidening object
124 IMPORT_C static CStereoWidening* NewL(CMdaAudioRecorderUtility& aUtility,
126 TBool aEnable = EFalse,
127 TInt8 aInitialLevel = 0);
130 * Factory function for creating the stereo widening object.
132 * @param aUtility A reference to an audio tone utility
133 * @param aEnable Indicate whether the effect will be automatically enabled after creation.
134 * @param aInitialLevel Initial value of stereo widening to be used when aEnable = ETrue
135 * @return pointer to CStereoWidening object
137 IMPORT_C static CStereoWidening* NewL(CMdaAudioToneUtility& aUtility,
138 TBool aEnable = EFalse,
139 TInt8 aInitialLevel = 0);
142 * Factory function for creating the stereo widening object.
144 * @param aDevSound A reference to a DevSound instance
145 * @param aEnable Indicate whether the effect will be automatically enabled after creation.
146 * @param aInitialLevel Initial value of stereo widening to be used when aEnable = ETrue
147 * @return pointer to CStereoWidening object
149 IMPORT_C static CStereoWidening* NewL(CMMFDevSound& aDevSound,
150 TBool aEnable = EFalse,
151 TInt8 aInitialLevel = 0);
154 * Factory function for creating the stereo widening object.
156 * @param aUtility A reference to a custom command utility
157 * @param aEnable Indicate whether the effect will be automatically enabled after creation.
158 * @param aInitialLevel Initial value of stereo widening to be used when aEnable = ETrue
159 * @return pointer to CStereoWidening object
161 IMPORT_C static CStereoWidening* NewL(CCustomCommandUtility* aUtility,
162 TBool aEnable = EFalse,
163 TInt8 aInitialLevel = 0);
166 * Factory function for creating the stereo widening object.
168 * @param aCustomInterface A reference to a custom interface
169 * @param aEnable Indicate whether the effect will be automatically enabled after creation.
170 * @param aInitialLevel Initial value of stereo widening to be used when aEnable = ETrue
171 * @return pointer to CStereoWidening object
173 IMPORT_C static CStereoWidening* NewL(MCustomInterface& aCustomInterface,
174 TBool aEnable = EFalse,
175 TInt8 aInitialLevel = 0);
178 * Factory function for creating the stereo widening object.
180 * @param aUtility A reference to a CMidiClientUtility
181 * @param aEnable Indicate whether the effect will be automatically enabled after creation.
182 * @param aInitialLevel Initial value of stereo widening to be used when aEnable = ETrue
183 * @return pointer to CStereoWidening object
185 IMPORT_C static CStereoWidening* NewL(CMidiClientUtility& aUtility,
186 TBool aEnable = EFalse,
187 TInt8 aInitialLevel = 0);
190 * Factory function for creating the stereo widening object.
192 * @param CDrmPlayerUtility A reference to a CDrmPlayerUtility object
193 * @return pointer to CStereoWidening object
195 IMPORT_C static CStereoWidening* NewL(CDrmPlayerUtility& aUtility,
196 TBool aEnable = EFalse,
197 TInt8 aInitialLevel = 0);
200 * Factory function for creating the stereo widening object.
202 * @param CVideoPlayerUtility A reference to a CVideoPlayerUtility object
203 * @return pointer to CStereoWidening object
205 IMPORT_C static CStereoWidening* NewL(CVideoPlayerUtility& aUtility,
206 TBool aEnable = EFalse,
207 TInt8 aInitialLevel = 0);
213 IMPORT_C virtual ~CStereoWidening();
216 * Check if continuous level is supported for stereo widening.
218 * @return ETrue if continuous level is supported for stereo widening. If this returns
219 * EFalse, then the adaptation is actually setting the level to the nearest supported discrete
220 * value, when SetStereoWidenlingLevelL is called.
222 IMPORT_C TBool IsContinuousLevelSupported() const;
225 * Set stereo widening level.
227 * @param aLevel Stereo widening level ranges from 0-100, where 0 is None and 100 is Maximum widening.
229 IMPORT_C void SetStereoWideningLevelL( TUint8 aLevel );
232 * Get the stereo widening settings.
234 * @return Level of widening
236 IMPORT_C TUint8 StereoWideningLevel() const;
239 public: // functions from base class
243 * Get the unique identifier of the audio effect
245 * @return Unique identifier
247 IMPORT_C TUid Uid() const;
249 protected: // Functions from base classes
253 * Create a package of the effect data
255 * @return A descriptor containing the effect data.
257 IMPORT_C const TDesC8& DoEffectData();
261 * Internal function to unpack effect data
263 * @param aEffectDataBuffer Descriptor containing packed effect data
266 IMPORT_C void SetEffectData( const TDesC8& aEffectDataBuffer );
271 * Private C++ constructor for this class.
273 * @param aEffectObserver reference to event observer object
276 IMPORT_C CStereoWidening();
280 // Balance data structure
281 TEfStereoWidening iStereoWideningData;
282 // Data package sent to server
283 TEfStereoWideningDataPckg iDataPckgTo;
284 // Data package received from server
285 TEfStereoWideningDataPckg iDataPckgFrom;
287 protected: // Friend classes
288 friend class CStereoWideningMessageHandler;
292 #endif // of CSTEREOWIDENING_H