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