Update contrib.
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: Implementation of the bassboost effect class
27 #include <BassBoostBase.h>
28 #include <CustomInterfaceUtility.h>
29 #include "BassBoostProxy.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>
38 #define DEBPRN0 RDebug::Printf( "%s", __PRETTY_FUNCTION__);
39 #define DEBPRN1(str) RDebug::Printf( "%s %s", __PRETTY_FUNCTION__, str );
45 // ============================ MEMBER FUNCTIONS ===============================
47 // -----------------------------------------------------------------------------
48 // CBassBoost::CBassBoost
49 // C++ default constructor can NOT contain any code, that
51 // -----------------------------------------------------------------------------
53 EXPORT_C CBassBoost::CBassBoost()
55 iDataPckgTo(iBassBoostData),
56 iDataPckgFrom(iBassBoostData)
61 EXPORT_C CBassBoost::~CBassBoost()
66 // -----------------------------------------------------------------------------
68 // Static function for creating an instance of the BassBoost object.
69 // -----------------------------------------------------------------------------
71 EXPORT_C CBassBoost* CBassBoost::NewL(
72 CMdaAudioInputStream& aUtility, TBool aEnable)
76 CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)aUtility.CustomInterface(KUidBassBoostEffect);
78 if (bassboostProxy == NULL)
80 DEBPRN1("No Adaptation Support - leaving");
81 User::Leave(KErrNotSupported);
86 bassboostProxy->EnableL();
89 return bassboostProxy;
92 // -----------------------------------------------------------------------------
94 // Static function for creating an instance of the BassBoost object.
95 // -----------------------------------------------------------------------------
97 EXPORT_C CBassBoost* CBassBoost::NewL(
98 CMdaAudioOutputStream& aUtility , TBool aEnable)
102 CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)aUtility.CustomInterface(KUidBassBoostEffect);
104 if (bassboostProxy == NULL)
106 DEBPRN1("No Adaptation Support - leaving");
107 User::Leave(KErrNotSupported);
112 bassboostProxy->EnableL();
115 return bassboostProxy;
118 // -----------------------------------------------------------------------------
120 // Static function for creating an instance of the BassBoost object.
121 // -----------------------------------------------------------------------------
123 EXPORT_C CBassBoost* CBassBoost::NewL(
124 CMdaAudioConvertUtility& aUtility , TBool aEnable)
128 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
129 CleanupStack::PushL(customInterface);
131 CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)customInterface->CustomInterface(KUidBassBoostEffect);
133 if ( !bassboostProxy )
135 DEBPRN1("No Adaptation Support - leaving");
136 User::Leave(KErrNotSupported);
139 CleanupStack::Pop(customInterface);
143 bassboostProxy->EnableL();
146 return bassboostProxy;
149 // -----------------------------------------------------------------------------
151 // Static function for creating an instance of the BassBoost object.
152 // -----------------------------------------------------------------------------
154 EXPORT_C CBassBoost* CBassBoost::NewL(
155 CMdaAudioPlayerUtility& aUtility , TBool aEnable)
159 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
160 CleanupStack::PushL(customInterface);
162 CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)customInterface->CustomInterface(KUidBassBoostEffect);
164 if ( !bassboostProxy )
166 DEBPRN1("No Adaptation Support - leaving");
167 User::Leave(KErrNotSupported);
170 CleanupStack::Pop(customInterface);
174 bassboostProxy->EnableL();
177 return bassboostProxy;
180 // -----------------------------------------------------------------------------
182 // Static function for creating an instance of the BassBoost object.
183 // -----------------------------------------------------------------------------
185 EXPORT_C CBassBoost* CBassBoost::NewL(
186 CMdaAudioRecorderUtility& aUtility,
187 TBool aRecordStream , TBool aEnable)
191 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility, aRecordStream);
192 CleanupStack::PushL(customInterface);
194 CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)customInterface->CustomInterface(KUidBassBoostEffect);
196 if ( !bassboostProxy )
198 DEBPRN1("No Adaptation Support - leaving");
199 User::Leave(KErrNotSupported);
202 CleanupStack::Pop(customInterface);
206 bassboostProxy->EnableL();
209 return bassboostProxy;
212 // -----------------------------------------------------------------------------
214 // Static function for creating an instance of the BassBoost object.
215 // -----------------------------------------------------------------------------
217 EXPORT_C CBassBoost* CBassBoost::NewL(
218 CMdaAudioToneUtility& aUtility, TBool aEnable)
222 CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)aUtility.CustomInterface(KUidBassBoostEffect);
224 if (bassboostProxy == NULL)
226 DEBPRN1("No Adaptation Support - leaving");
227 User::Leave(KErrNotSupported);
232 bassboostProxy->EnableL();
235 return bassboostProxy;
238 // -----------------------------------------------------------------------------
240 // Static function for creating an instance of the BassBoost object.
241 // -----------------------------------------------------------------------------
243 EXPORT_C CBassBoost* CBassBoost::NewL(
244 CMMFDevSound& aDevSound, TBool aEnable )
248 CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)aDevSound.CustomInterface(KUidBassBoostEffect);
250 if (bassboostProxy == NULL)
252 DEBPRN1("No Adaptation Support - leaving");
253 User::Leave(KErrNotSupported);
258 bassboostProxy->EnableL();
261 return bassboostProxy;
264 // -----------------------------------------------------------------------------
266 // Static function for creating an instance of the BassBoost object.
267 // -----------------------------------------------------------------------------
269 EXPORT_C CBassBoost* CBassBoost::NewL(
270 CCustomCommandUtility* aUtility, TBool aEnable )
274 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
275 CleanupStack::PushL(customInterface);
277 CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)customInterface->CustomInterface(KUidBassBoostEffect);
279 if ( !bassboostProxy )
281 DEBPRN1("No Adaptation Support - leaving");
282 User::Leave(KErrNotSupported);
285 CleanupStack::Pop(customInterface);
289 bassboostProxy->EnableL();
292 return bassboostProxy;
295 // -----------------------------------------------------------------------------
297 // Static function for creating an instance of the BassBoost object.
298 // -----------------------------------------------------------------------------
300 EXPORT_C CBassBoost* CBassBoost::NewL(
301 MCustomInterface& aCustomInterface , TBool aEnable)
305 CBassBoost* bassboostProxy = (CBassBoost*)aCustomInterface.CustomInterface(KUidBassBoostEffect);
307 if ( !bassboostProxy )
309 DEBPRN1("No Adaptation Support - leaving");
310 User::Leave(KErrNotSupported);
315 bassboostProxy->EnableL();
318 return bassboostProxy;
321 // -----------------------------------------------------------------------------
323 // Static function for creating an instance of the BassBoost object.
324 // -----------------------------------------------------------------------------
326 EXPORT_C CBassBoost* CBassBoost::NewL(
327 CMidiClientUtility& aUtility, TBool aEnable )
331 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
332 CleanupStack::PushL(customInterface);
334 CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)customInterface->CustomInterface(KUidBassBoostEffect);
336 if ( !bassboostProxy )
338 DEBPRN1("No Adaptation Support - leaving");
339 User::Leave(KErrNotSupported);
342 CleanupStack::Pop(customInterface);
346 bassboostProxy->EnableL();
349 return bassboostProxy;
352 // -----------------------------------------------------------------------------
354 // Static function for creating an instance of the BassBoost object.
355 // -----------------------------------------------------------------------------
357 EXPORT_C CBassBoost* CBassBoost::NewL(
358 CDrmPlayerUtility& aUtility, TBool aEnable)
362 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
363 CleanupStack::PushL(customInterface);
365 CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)customInterface->CustomInterface(KUidBassBoostEffect);
367 if ( !bassboostProxy )
369 DEBPRN1("No Adaptation Support - leaving");
370 User::Leave(KErrNotSupported);
373 CleanupStack::Pop(customInterface);
377 bassboostProxy->EnableL();
380 return bassboostProxy;
383 // -----------------------------------------------------------------------------
385 // Static function for creating an instance of the BassBoost object.
386 // -----------------------------------------------------------------------------
388 EXPORT_C CBassBoost* CBassBoost::NewL(
389 CVideoPlayerUtility& aUtility, TBool aEnable)
393 CCustomInterfaceUtility* customInterface = CCustomInterfaceUtility::NewL(aUtility);
394 CleanupStack::PushL(customInterface);
396 CBassBoostProxy* bassboostProxy = (CBassBoostProxy*)customInterface->CustomInterface(KUidBassBoostEffect);
398 if ( !bassboostProxy )
400 DEBPRN1("No Adaptation Support - leaving");
401 User::Leave(KErrNotSupported);
404 CleanupStack::Pop(customInterface);
408 bassboostProxy->EnableL();
411 return bassboostProxy;
414 // -----------------------------------------------------------------------------
415 // CBassBoost::DoEffectData
416 // -----------------------------------------------------------------------------
418 EXPORT_C const TDesC8& CBassBoost::DoEffectData()
421 iDataPckgTo = iBassBoostData;
425 // -----------------------------------------------------------------------------
426 // CBassBoost::SetEffectData
427 // -----------------------------------------------------------------------------
429 EXPORT_C void CBassBoost::SetEffectData(
430 const TDesC8& aEffectDataBuffer )
433 TEfBassBoostDataPckg dataPckg;
434 dataPckg.Copy(aEffectDataBuffer);
435 iBassBoostData = dataPckg();
436 iEnabled = iBassBoostData.iEnabled;
437 iEnforced = iBassBoostData.iEnforced;
438 iHaveUpdateRights = iBassBoostData.iHaveUpdateRights;
442 // -----------------------------------------------------------------------------
444 // -----------------------------------------------------------------------------
446 EXPORT_C TUid CBassBoost::Uid() const
448 return KUidBassBoostEffect;
452 // ========================== OTHER EXPORTED FUNCTIONS =========================