|
1 /* |
|
2 * Copyright (c) 2006 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: Implementation of the Loudness effect class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 |
|
23 #ifdef _DEBUG |
|
24 #include <e32svr.h> |
|
25 #endif |
|
26 |
|
27 #include <LoudnessBase.h> |
|
28 #include <CustomInterfaceUtility.h> |
|
29 #include "LoudnessProxy.h" |
|
30 #include <DrmAudioSamplePlayer.h> |
|
31 #include <mdaaudioinputstream.h> |
|
32 #include <mdaaudiooutputstream.h> |
|
33 #include <mdaaudiotoneplayer.h> |
|
34 #include <mmf/server/sounddevice.h> |
|
35 #include <videoplayer.h> |
|
36 |
|
37 #ifdef _DEBUG |
|
38 #define DEBPRN0 RDebug::Printf( "%s", __PRETTY_FUNCTION__); |
|
39 #define DEBPRN1(str) RDebug::Printf( "%s %s", __PRETTY_FUNCTION__, str ); |
|
40 #else |
|
41 #define DEBPRN0 |
|
42 #define DEBPRN1(str) |
|
43 #endif |
|
44 |
|
45 // ============================ MEMBER FUNCTIONS =============================== |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CLoudness::CLoudness |
|
49 // C++ default constructor can NOT contain any code, that |
|
50 // might leave. |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 EXPORT_C CLoudness::CLoudness() |
|
54 : iLoudnessData(), |
|
55 iDataPckgTo(iLoudnessData) |
|
56 { |
|
57 } |
|
58 |
|
59 // Destructor |
|
60 EXPORT_C CLoudness::~CLoudness() |
|
61 { |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // CLoudness::NewL |
|
66 // Static function for creating an instance of the Loudness object. |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 EXPORT_C CLoudness* CLoudness::NewL(CMdaAudioConvertUtility& aUtility) |
|
70 { |
|
71 |
|
72 DEBPRN0; |
|
73 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); |
|
74 CleanupStack::PushL(customInterface); |
|
75 |
|
76 CLoudnessProxy* loudnessProxy = (CLoudnessProxy*)customInterface->CustomInterface(KUidLoudnessEffect); |
|
77 |
|
78 if ( !loudnessProxy ) |
|
79 { |
|
80 DEBPRN1("No Adaptation Support - leaving"); |
|
81 User::Leave(KErrNotSupported); |
|
82 } |
|
83 |
|
84 CleanupStack::Pop(customInterface); |
|
85 |
|
86 return loudnessProxy; |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CLoudness::NewL |
|
91 // Static function for creating an instance of the Loudness object. |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 EXPORT_C CLoudness* CLoudness::NewL( |
|
95 CMdaAudioInputStream& aUtility , TBool aEnable ) |
|
96 { |
|
97 |
|
98 DEBPRN0; |
|
99 CLoudnessProxy* loudnessProxy = (CLoudnessProxy*)aUtility.CustomInterface(KUidLoudnessEffect); |
|
100 |
|
101 if (loudnessProxy == NULL) |
|
102 { |
|
103 DEBPRN1("No Adaptation Support - leaving"); |
|
104 User::Leave(KErrNotSupported); |
|
105 } |
|
106 |
|
107 if(aEnable) |
|
108 { |
|
109 loudnessProxy->EnableL(); |
|
110 } |
|
111 |
|
112 return loudnessProxy; |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // CLoudness::NewL |
|
117 // Static function for creating an instance of the Loudness object. |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 EXPORT_C CLoudness* CLoudness::NewL( |
|
121 CMdaAudioOutputStream& aUtility, TBool aEnable ) |
|
122 { |
|
123 |
|
124 DEBPRN0; |
|
125 CLoudnessProxy* loudnessProxy = (CLoudnessProxy*)aUtility.CustomInterface(KUidLoudnessEffect); |
|
126 |
|
127 if (loudnessProxy == NULL) |
|
128 { |
|
129 DEBPRN1("No Adaptation Support - leaving"); |
|
130 User::Leave(KErrNotSupported); |
|
131 } |
|
132 |
|
133 if(aEnable) |
|
134 { |
|
135 loudnessProxy->EnableL(); |
|
136 } |
|
137 |
|
138 return loudnessProxy; |
|
139 } |
|
140 |
|
141 // ----------------------------------------------------------------------------- |
|
142 // CLoudness::NewL |
|
143 // Static function for creating an instance of the Loudness object. |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 EXPORT_C CLoudness* CLoudness::NewL( |
|
147 CMdaAudioPlayerUtility& aUtility , TBool aEnable) |
|
148 { |
|
149 |
|
150 DEBPRN0; |
|
151 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); |
|
152 CleanupStack::PushL(customInterface); |
|
153 |
|
154 CLoudnessProxy* loudnessProxy = (CLoudnessProxy*)customInterface->CustomInterface(KUidLoudnessEffect); |
|
155 |
|
156 if ( !loudnessProxy ) |
|
157 { |
|
158 DEBPRN1("No Adaptation Support - leaving"); |
|
159 User::Leave(KErrNotSupported); |
|
160 } |
|
161 |
|
162 CleanupStack::Pop(customInterface); |
|
163 |
|
164 if(aEnable) |
|
165 { |
|
166 loudnessProxy->EnableL(); |
|
167 } |
|
168 |
|
169 return loudnessProxy; |
|
170 } |
|
171 |
|
172 // ----------------------------------------------------------------------------- |
|
173 // CLoudness::NewL |
|
174 // Static function for creating an instance of the Loudness object. |
|
175 // ----------------------------------------------------------------------------- |
|
176 // |
|
177 EXPORT_C CLoudness* CLoudness::NewL( |
|
178 CMdaAudioRecorderUtility& aUtility, TBool aRecordStream, TBool aEnable) |
|
179 { |
|
180 |
|
181 DEBPRN0; |
|
182 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility, aRecordStream); |
|
183 CleanupStack::PushL(customInterface); |
|
184 |
|
185 CLoudnessProxy* loudnessProxy = (CLoudnessProxy*)customInterface->CustomInterface(KUidLoudnessEffect); |
|
186 |
|
187 if ( !loudnessProxy ) |
|
188 { |
|
189 DEBPRN1("No Adaptation Support - leaving"); |
|
190 User::Leave(KErrNotSupported); |
|
191 } |
|
192 |
|
193 CleanupStack::Pop(customInterface); |
|
194 |
|
195 if(aEnable) |
|
196 { |
|
197 loudnessProxy->EnableL(); |
|
198 } |
|
199 |
|
200 return loudnessProxy; |
|
201 } |
|
202 |
|
203 // ----------------------------------------------------------------------------- |
|
204 // CLoudness::NewL |
|
205 // Static function for creating an instance of the Loudness object. |
|
206 // ----------------------------------------------------------------------------- |
|
207 // |
|
208 EXPORT_C CLoudness* CLoudness::NewL( |
|
209 CMdaAudioToneUtility& aUtility, TBool aEnable ) |
|
210 { |
|
211 |
|
212 DEBPRN0; |
|
213 CLoudnessProxy* loudnessProxy = (CLoudnessProxy*)aUtility.CustomInterface(KUidLoudnessEffect); |
|
214 |
|
215 if (loudnessProxy == NULL) |
|
216 { |
|
217 DEBPRN1("No Adaptation Support - leaving"); |
|
218 User::Leave(KErrNotSupported); |
|
219 } |
|
220 |
|
221 if(aEnable) |
|
222 { |
|
223 loudnessProxy->EnableL(); |
|
224 } |
|
225 |
|
226 return loudnessProxy; |
|
227 } |
|
228 |
|
229 |
|
230 // ----------------------------------------------------------------------------- |
|
231 // CLoudness::NewL |
|
232 // Static function for creating an instance of the Loudness object. |
|
233 // ----------------------------------------------------------------------------- |
|
234 // |
|
235 EXPORT_C CLoudness* CLoudness::NewL( |
|
236 CMMFDevSound& aDevSound , TBool aEnable ) |
|
237 { |
|
238 |
|
239 DEBPRN0; |
|
240 CLoudnessProxy* loudnessProxy = (CLoudnessProxy*)aDevSound.CustomInterface(KUidLoudnessEffect); |
|
241 |
|
242 if (loudnessProxy == NULL) |
|
243 { |
|
244 DEBPRN1("No Adaptation Support - leaving"); |
|
245 User::Leave(KErrNotSupported); |
|
246 } |
|
247 |
|
248 if(aEnable) |
|
249 { |
|
250 loudnessProxy->EnableL(); |
|
251 } |
|
252 |
|
253 return loudnessProxy; |
|
254 } |
|
255 |
|
256 |
|
257 |
|
258 // ----------------------------------------------------------------------------- |
|
259 // CLoudness::NewL |
|
260 // Static function for creating an instance of the Loudness object. |
|
261 // ----------------------------------------------------------------------------- |
|
262 // |
|
263 EXPORT_C CLoudness* CLoudness::NewL( |
|
264 CCustomCommandUtility* aUtility , TBool aEnable) |
|
265 { |
|
266 |
|
267 DEBPRN0; |
|
268 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); |
|
269 CleanupStack::PushL(customInterface); |
|
270 |
|
271 CLoudnessProxy* loudnessProxy = (CLoudnessProxy*)customInterface->CustomInterface(KUidLoudnessEffect); |
|
272 |
|
273 if ( !loudnessProxy ) |
|
274 { |
|
275 DEBPRN1("No Adaptation Support - leaving"); |
|
276 User::Leave(KErrNotSupported); |
|
277 } |
|
278 |
|
279 CleanupStack::Pop(customInterface); |
|
280 |
|
281 if(aEnable) |
|
282 { |
|
283 loudnessProxy->EnableL(); |
|
284 } |
|
285 |
|
286 return loudnessProxy; |
|
287 } |
|
288 |
|
289 // ----------------------------------------------------------------------------- |
|
290 // CLoudness::NewL |
|
291 // Static function for creating an instance of the Loudness object. |
|
292 // ----------------------------------------------------------------------------- |
|
293 // |
|
294 EXPORT_C CLoudness* CLoudness::NewL( |
|
295 MCustomInterface& aCustomInterface , TBool aEnable) |
|
296 { |
|
297 |
|
298 DEBPRN0; |
|
299 CLoudnessProxy* loudnessProxy = (CLoudnessProxy*)aCustomInterface.CustomInterface(KUidLoudnessEffect); |
|
300 |
|
301 if ( !loudnessProxy ) |
|
302 { |
|
303 DEBPRN1("No Adaptation Support - leaving"); |
|
304 User::Leave(KErrNotSupported); |
|
305 } |
|
306 |
|
307 if(aEnable) |
|
308 { |
|
309 loudnessProxy->EnableL(); |
|
310 } |
|
311 |
|
312 return loudnessProxy; |
|
313 } |
|
314 |
|
315 // ----------------------------------------------------------------------------- |
|
316 // CLoudness::NewL |
|
317 // Static function for creating an instance of the Loudness object. |
|
318 // ----------------------------------------------------------------------------- |
|
319 // |
|
320 EXPORT_C CLoudness* CLoudness::NewL( |
|
321 CMidiClientUtility& aUtility , TBool aEnable) |
|
322 { |
|
323 |
|
324 DEBPRN0; |
|
325 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); |
|
326 CleanupStack::PushL(customInterface); |
|
327 |
|
328 CLoudnessProxy* loudnessProxy = (CLoudnessProxy*)customInterface->CustomInterface(KUidLoudnessEffect); |
|
329 |
|
330 if ( !loudnessProxy ) |
|
331 { |
|
332 DEBPRN1("No Adaptation Support - leaving"); |
|
333 User::Leave(KErrNotSupported); |
|
334 } |
|
335 |
|
336 CleanupStack::Pop(customInterface); |
|
337 |
|
338 if(aEnable) |
|
339 { |
|
340 loudnessProxy->EnableL(); |
|
341 } |
|
342 |
|
343 return loudnessProxy; |
|
344 } |
|
345 |
|
346 // ----------------------------------------------------------------------------- |
|
347 // CLoudness::NewL |
|
348 // Static function for creating an instance of the Loudness object. |
|
349 // ----------------------------------------------------------------------------- |
|
350 // |
|
351 EXPORT_C CLoudness* CLoudness::NewL( |
|
352 CDrmPlayerUtility& aUtility, TBool aEnable) |
|
353 { |
|
354 |
|
355 DEBPRN0; |
|
356 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); |
|
357 CleanupStack::PushL(customInterface); |
|
358 |
|
359 CLoudnessProxy* loudnessProxy = (CLoudnessProxy*)customInterface->CustomInterface(KUidLoudnessEffect); |
|
360 |
|
361 if ( !loudnessProxy ) |
|
362 { |
|
363 DEBPRN1("No Adaptation Support - leaving"); |
|
364 User::Leave(KErrNotSupported); |
|
365 } |
|
366 |
|
367 CleanupStack::Pop(customInterface); |
|
368 |
|
369 if(aEnable) |
|
370 { |
|
371 loudnessProxy->EnableL(); |
|
372 } |
|
373 |
|
374 return loudnessProxy; |
|
375 } |
|
376 |
|
377 // ----------------------------------------------------------------------------- |
|
378 // CLoudness::NewL |
|
379 // Static function for creating an instance of the Loudness object. |
|
380 // ----------------------------------------------------------------------------- |
|
381 // |
|
382 EXPORT_C CLoudness* CLoudness::NewL( |
|
383 CVideoPlayerUtility& aUtility, TBool aEnable) |
|
384 { |
|
385 |
|
386 DEBPRN0; |
|
387 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility); |
|
388 CleanupStack::PushL(customInterface); |
|
389 |
|
390 CLoudnessProxy* loudnessProxy = (CLoudnessProxy*)customInterface->CustomInterface(KUidLoudnessEffect); |
|
391 |
|
392 if ( !loudnessProxy ) |
|
393 { |
|
394 DEBPRN1("No Adaptation Support - leaving"); |
|
395 User::Leave(KErrNotSupported); |
|
396 } |
|
397 |
|
398 CleanupStack::Pop(customInterface); |
|
399 |
|
400 if(aEnable) |
|
401 { |
|
402 loudnessProxy->EnableL(); |
|
403 } |
|
404 |
|
405 return loudnessProxy; |
|
406 } |
|
407 |
|
408 // ----------------------------------------------------------------------------- |
|
409 // CLoudness::Uid |
|
410 // ----------------------------------------------------------------------------- |
|
411 // |
|
412 EXPORT_C TUid CLoudness::Uid() const |
|
413 { |
|
414 return KUidLoudnessEffect; |
|
415 } |
|
416 |
|
417 |
|
418 // ----------------------------------------------------------------------------- |
|
419 // CLoudness::DoEffectData |
|
420 // ----------------------------------------------------------------------------- |
|
421 // |
|
422 EXPORT_C const TDesC8& CLoudness::DoEffectData() |
|
423 { |
|
424 DEBPRN0; |
|
425 iDataPckgTo = iLoudnessData; |
|
426 return iDataPckgTo; |
|
427 } |
|
428 |
|
429 // ----------------------------------------------------------------------------- |
|
430 // CLoudness::SetEffectData |
|
431 // ----------------------------------------------------------------------------- |
|
432 // |
|
433 EXPORT_C void CLoudness::SetEffectData( |
|
434 const TDesC8& aEffectDataBuffer ) |
|
435 { |
|
436 DEBPRN0; |
|
437 TEfLoudnessDataPckg dataPckg; |
|
438 dataPckg.Copy(aEffectDataBuffer); |
|
439 iLoudnessData = dataPckg(); |
|
440 iEnabled = iLoudnessData.iEnabled; |
|
441 iEnforced = iLoudnessData.iEnforced; |
|
442 iHaveUpdateRights = iLoudnessData.iHaveUpdateRights; |
|
443 |
|
444 } |
|
445 |
|
446 |
|
447 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
448 |
|
449 // End of File |
|
450 |