audiostubs/devsoundextensions_stubs/audiocodeccistubs/sbcencoderintfccistub/src/SbcEncoderIntfcCIStub.cpp
changeset 0 0ce1b5ce9557
child 3 f935d51494d1
equal deleted inserted replaced
-1:000000000000 0:0ce1b5ce9557
       
     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: Audio Stubs -  Custom Interface stub object for configuring the SBC encoder.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32debug.h>
       
    21 #include "SbcEncoderIntfcCI.h"
       
    22 
       
    23 // EXTERNAL DATA STRUCTURES
       
    24 
       
    25 // EXTERNAL FUNCTION PROTOTYPES
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 // MACROS
       
    30 
       
    31 // LOCAL CONSTANTS AND MACROS
       
    32 
       
    33 // MODULE DATA STRUCTURES
       
    34 
       
    35 // LOCAL FUNCTION PROTOTYPES
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 
       
    39 // ============================= LOCAL FUNCTIONS ===============================
       
    40 
       
    41 // ============================ MEMBER FUNCTIONS ===============================
       
    42 
       
    43 /**
       
    44  * CSbcEncoderIntfcCI::CSbcEncoderIntfcCI
       
    45  * C++ default constructor.
       
    46  */
       
    47 CSbcEncoderIntfcCI::CSbcEncoderIntfcCI()
       
    48     {
       
    49     }
       
    50 
       
    51 /**
       
    52  * CSbcEncoderIntfcCI::ConstructL
       
    53  * Symbian 2nd phase constructor.
       
    54  */
       
    55 void CSbcEncoderIntfcCI::ConstructL()
       
    56     {
       
    57     }
       
    58 
       
    59 /**
       
    60  * CSbcEncoderIntfcCI::NewL
       
    61  * Two-phased constructor.
       
    62  */
       
    63 EXPORT_C CSbcEncoderIntfcCI* CSbcEncoderIntfcCI::NewL()
       
    64     {
       
    65 	CSbcEncoderIntfcCI* self = new (ELeave)CSbcEncoderIntfcCI;
       
    66 	CleanupStack::PushL(self);
       
    67 	self->ConstructL();
       
    68 	CleanupStack::Pop(self);
       
    69 	return self;
       
    70     }
       
    71 
       
    72 /**
       
    73  * Destructor
       
    74  */
       
    75 EXPORT_C CSbcEncoderIntfcCI::~CSbcEncoderIntfcCI()
       
    76     {
       
    77     }
       
    78 
       
    79 /**
       
    80  * CSbcEncoderIntfcCI::GetSupportedSamplingFrequencies
       
    81  * Returns and array of supported sampling frequencies.
       
    82  * (other items were commented in a header).
       
    83  */
       
    84 EXPORT_C TInt CSbcEncoderIntfcCI::GetSupportedSamplingFrequencies(
       
    85                                   RArray<TUint>& aSupportedSamplingFrequencies)
       
    86     {
       
    87     aSupportedSamplingFrequencies.Reset();
       
    88     aSupportedSamplingFrequencies.Append(16000);
       
    89     aSupportedSamplingFrequencies.Append(32000);
       
    90     aSupportedSamplingFrequencies.Append(44100);
       
    91     aSupportedSamplingFrequencies.Append(48000);
       
    92 
       
    93 #ifdef _DEBUG
       
    94     RDebug::Print(_L("CSbcEncoderIntfcCI::GetSupportedSamplingFrequencies - Num of supported Fs[%d]"),
       
    95                   aSupportedSamplingFrequencies.Count());
       
    96 #endif
       
    97 	return KErrNone;
       
    98     }
       
    99 
       
   100 /*
       
   101  * CSbcEncoderIntfcCI::GetSupportedChannelModes
       
   102  * Returns and array of supported channel modes.
       
   103  * (other items were commented in a header).
       
   104  */
       
   105 EXPORT_C TInt CSbcEncoderIntfcCI::GetSupportedChannelModes(
       
   106                                   RArray<TSbcChannelMode>&
       
   107                                   aSupportedChannelModes)
       
   108     {
       
   109     aSupportedChannelModes.Reset();
       
   110     aSupportedChannelModes.Append(ESbcChannelMono);
       
   111     aSupportedChannelModes.Append(ESbcChannelDual);
       
   112     aSupportedChannelModes.Append(ESbcChannelStereo);
       
   113     aSupportedChannelModes.Append(ESbcChannelJointStereo);
       
   114 
       
   115 #ifdef _DEBUG
       
   116     RDebug::Print(_L("CSbcEncoderIntfcCI::GetSupportedChannelModes - Num of supported ch modes[%d]"),
       
   117                   aSupportedChannelModes.Count());
       
   118 #endif
       
   119     return KErrNone;
       
   120     }
       
   121 
       
   122 /*
       
   123  * CSbcEncoderIntfcCI::GetSupportedNumOfBlocks
       
   124  * Returns an array of supported block numbers.
       
   125  * (other items were commented in a header).
       
   126  */
       
   127 EXPORT_C TInt CSbcEncoderIntfcCI::GetSupportedNumOfBlocks(
       
   128 		                          RArray<TUint>& aSupportedNumOfBlocks)
       
   129     {
       
   130     aSupportedNumOfBlocks.Reset();
       
   131     aSupportedNumOfBlocks.Append(4);
       
   132     aSupportedNumOfBlocks.Append(8);
       
   133     aSupportedNumOfBlocks.Append(12);
       
   134     aSupportedNumOfBlocks.Append(16);
       
   135 
       
   136 #ifdef _DEBUG
       
   137     RDebug::Print(_L("CSbcEncoderIntfcCI::GetSupportedNumOfBlocks - Num of supported blocks[%d]"),
       
   138                   aSupportedNumOfBlocks.Count());
       
   139 #endif
       
   140     return KErrNone;
       
   141     }
       
   142 
       
   143 /*
       
   144  * CSbcEncoderIntfcCI::GetSupportedNumOfSubbands
       
   145  * Returns an array of supported subbands.
       
   146  * (other items were commented in a header).
       
   147  */
       
   148 EXPORT_C TInt CSbcEncoderIntfcCI::GetSupportedNumOfSubbands(
       
   149                                   RArray<TUint>& aSupportedNumOfSubbands)
       
   150     {
       
   151     aSupportedNumOfSubbands.Reset();
       
   152     aSupportedNumOfSubbands.Append(4);
       
   153     aSupportedNumOfSubbands.Append(8);
       
   154 
       
   155 #ifdef _DEBUG
       
   156     RDebug::Print(_L("CSbcEncoderIntfcCI::GetSupportedNumOfSubbands - Num of supported subbands[%d]"),
       
   157                   aSupportedNumOfSubbands.Count());
       
   158 #endif
       
   159     return KErrNone;
       
   160     }
       
   161 
       
   162 /*
       
   163  * CSbcEncoderIntfcCI::GetSupportedAllocationMethods
       
   164  * Returns an array of supported allocation methods.
       
   165  * (other items were commented in a header).
       
   166  */
       
   167 EXPORT_C TInt CSbcEncoderIntfcCI::GetSupportedAllocationMethods(
       
   168                                   RArray<TSbcAllocationMethod>&
       
   169                                   aSupportedAllocationMethods)
       
   170     {
       
   171     aSupportedAllocationMethods.Reset();
       
   172     aSupportedAllocationMethods.Append(ESbcAllocationSNR);
       
   173     aSupportedAllocationMethods.Append(ESbcAllocationLoudness);
       
   174 
       
   175 #ifdef _DEBUG
       
   176     RDebug::Print(_L("CSbcEncoderIntfcCI::GetSupportedAllocationMethods - Num of supported alloc methods[%d]"),
       
   177                   aSupportedAllocationMethods.Count());
       
   178 #endif
       
   179     return KErrNone;
       
   180     }
       
   181 
       
   182 /*
       
   183  * CSbcEncoderIntfcCI::GetSupportedBitpoolRange
       
   184  * Returns supported bitpool range.
       
   185  * (other items were commented in a header).
       
   186  */
       
   187 EXPORT_C TInt CSbcEncoderIntfcCI::GetSupportedBitpoolRange(
       
   188         		                  TUint& aMinSupportedBitpoolSize,
       
   189         		                  TUint& aMaxSupportedBitpoolSize)
       
   190     {
       
   191     aMinSupportedBitpoolSize = 2;
       
   192     aMaxSupportedBitpoolSize = 250;
       
   193 
       
   194 #ifdef _DEBUG
       
   195     RDebug::Print(_L("CSbcEncoderIntfcCI::GetSupportedBitpoolRange - Min[%d] - Max [%d]"),
       
   196                   aMinSupportedBitpoolSize,
       
   197                   aMaxSupportedBitpoolSize);
       
   198 #endif
       
   199     return KErrNone;
       
   200     }
       
   201 
       
   202 /*
       
   203  * CSbcEncoderIntfcCI::SetSamplingFrequency
       
   204  * Sets new sampling frequency.
       
   205  * (other items were commented in a header).
       
   206  */
       
   207 EXPORT_C void CSbcEncoderIntfcCI::SetSamplingFrequency(TUint aSamplingFrequency)
       
   208     {
       
   209     iSamplingFrequency = aSamplingFrequency;
       
   210 
       
   211 #ifdef _DEBUG
       
   212     RDebug::Print(_L("CSbcEncoderIntfcCI::SetSamplingFrequency [%d]"),
       
   213                   iSamplingFrequency);
       
   214 #endif
       
   215     }
       
   216 
       
   217 /*
       
   218  * CSbcEncoderIntfcCI::GetSamplingFrequency
       
   219  * Returns current sampling frequency.
       
   220  * (other items were commented in a header).
       
   221  */
       
   222 EXPORT_C TInt CSbcEncoderIntfcCI::GetSamplingFrequency(
       
   223                                   TUint& aSamplingFrequency)
       
   224     {
       
   225     aSamplingFrequency = iCurrentSamplingFrequency;
       
   226 
       
   227 #ifdef _DEBUG
       
   228     RDebug::Print(_L("CSbcEncoderIntfcCI::GetSamplingFrequency [%d]"),
       
   229                   iCurrentSamplingFrequency);
       
   230 #endif
       
   231     return KErrNone;
       
   232     }
       
   233 
       
   234 /*
       
   235  * CSbcEncoderIntfcCI::SetChannelMode
       
   236  * Sets new channel mode.
       
   237  * (other items were commented in a header).
       
   238  */
       
   239 EXPORT_C void CSbcEncoderIntfcCI::SetChannelMode(TSbcChannelMode aChannelMode)
       
   240     {
       
   241     iChannelMode = aChannelMode;
       
   242 
       
   243 #ifdef _DEBUG
       
   244     RDebug::Print(_L("CSbcEncoderIntfcCI::SetChannelMode [%d]"), iChannelMode);
       
   245 #endif
       
   246     }
       
   247 
       
   248 /*
       
   249  * CSbcEncoderIntfcCI::GetChannelMode
       
   250  * Returns current channel mode.
       
   251  * (other items were commented in a header).
       
   252  */
       
   253 EXPORT_C TInt CSbcEncoderIntfcCI::GetChannelMode(TSbcChannelMode& aChannelMode)
       
   254     {
       
   255     aChannelMode = iCurrentChannelMode;
       
   256 
       
   257 #ifdef _DEBUG
       
   258     RDebug::Print(_L("CSbcEncoderIntfcCI::GetChannelMode [%d]"),
       
   259                   iCurrentChannelMode);
       
   260 #endif
       
   261     return KErrNone;
       
   262     }
       
   263 
       
   264 /*
       
   265  * CSbcEncoderIntfcCI::SetNumOfSubbands
       
   266  * Sets new number of subbands.
       
   267  * (other items were commented in a header).
       
   268  */
       
   269 EXPORT_C void CSbcEncoderIntfcCI::SetNumOfSubbands(TUint aNumOfSubbands)
       
   270     {
       
   271     iNumOfSubbands = aNumOfSubbands;
       
   272 
       
   273 #ifdef _DEBUG
       
   274     RDebug::Print(_L("CSbcEncoderIntfcCI::SetNumOfSubbands [%d]"),
       
   275                   iNumOfSubbands);
       
   276 #endif
       
   277     }
       
   278 
       
   279 /*
       
   280  * CSbcEncoderIntfcCI::GetNumOfSubbands
       
   281  * Returns current number of subbands.
       
   282  * (other items were commented in a header).
       
   283  */
       
   284 EXPORT_C TInt CSbcEncoderIntfcCI::GetNumOfSubbands(TUint& aNumOfSubbands)
       
   285     {
       
   286     aNumOfSubbands = iCurrentNumOfSubbands;
       
   287 
       
   288 #ifdef _DEBUG
       
   289     RDebug::Print(_L("CSbcEncoderIntfcCI::GetNumOfSubbands [%d]"),
       
   290                   iCurrentNumOfSubbands);
       
   291 #endif
       
   292     return KErrNone;
       
   293     }
       
   294 
       
   295 /*
       
   296  * CSbcEncoderIntfcCI::SetNumOfBlocks
       
   297  * Sets new number of blocks.
       
   298  * (other items were commented in a header).
       
   299  */
       
   300 EXPORT_C void CSbcEncoderIntfcCI::SetNumOfBlocks(TUint aNumOfBlocks)
       
   301     {
       
   302     iNumOfBlocks = aNumOfBlocks;
       
   303 
       
   304 #ifdef _DEBUG
       
   305     RDebug::Print(_L("CSbcEncoderIntfcCI::SetNumOfBlocks [%d]"), iNumOfBlocks);
       
   306 #endif
       
   307     }
       
   308 
       
   309 /*
       
   310  * CSbcEncoderIntfcCI::GetNumOfBlocks
       
   311  * Returns current number of blocks.
       
   312  * (other items were commented in a header).
       
   313  */
       
   314 EXPORT_C TInt CSbcEncoderIntfcCI::GetNumOfBlocks(TUint& aNumOfBlocks)
       
   315     {
       
   316     aNumOfBlocks = iCurrentNumOfBlocks;
       
   317 
       
   318 #ifdef _DEBUG
       
   319     RDebug::Print(_L("CSbcEncoderIntfcCI::GetNumOfBlocks [%d]"),
       
   320                   iCurrentNumOfBlocks);
       
   321 #endif
       
   322     return KErrNone;
       
   323     }
       
   324 
       
   325 /*
       
   326  * CSbcEncoderIntfcCI::SetAllocationMethod
       
   327  * Sets new allocation method.
       
   328  * (other items were commented in a header).
       
   329  */
       
   330 EXPORT_C void CSbcEncoderIntfcCI::SetAllocationMethod(
       
   331                                   TSbcAllocationMethod aAllocationMethod)
       
   332     {
       
   333     iAllocationMethod = aAllocationMethod;
       
   334 
       
   335 #ifdef _DEBUG
       
   336     RDebug::Print(_L("CSbcEncoderIntfcCI::SetAllocationMethod [%d]"),
       
   337                   iAllocationMethod);
       
   338 #endif
       
   339     }
       
   340 
       
   341 /*
       
   342  * CSbcEncoderIntfcCI::GetAllocationMethod
       
   343  * Returns current allocation method.
       
   344  * (other items were commented in a header).
       
   345  */
       
   346 EXPORT_C TInt CSbcEncoderIntfcCI::GetAllocationMethod(
       
   347                                   TSbcAllocationMethod& aAllocationMethod)
       
   348     {
       
   349     aAllocationMethod = iCurrentAllocationMethod;
       
   350 
       
   351 #ifdef _DEBUG
       
   352     RDebug::Print(_L("CSbcEncoderIntfcCI::GetAllocationMethod [%d]"),
       
   353                   iCurrentAllocationMethod);
       
   354 #endif
       
   355     return KErrNone;
       
   356     }
       
   357 
       
   358 /*
       
   359  * CSbcEncoderIntfcCI::SetBitpoolSize
       
   360  * Sets new bitpool size.
       
   361  * (other items were commented in a header).
       
   362  */
       
   363 EXPORT_C void CSbcEncoderIntfcCI::SetBitpoolSize(TUint aBitpoolSize)
       
   364     {
       
   365     iBitpoolSize = aBitpoolSize;
       
   366 
       
   367 #ifdef _DEBUG
       
   368     RDebug::Print(_L("CSbcEncoderIntfcCI::SetBitpoolSize [%d]"), iBitpoolSize);
       
   369 #endif
       
   370     }
       
   371 
       
   372 /*
       
   373  * CSbcEncoderIntfcCI::GetBitpoolSize
       
   374  * Returns current bitpool size.
       
   375  * (other items were commented in a header).
       
   376  */
       
   377 EXPORT_C TInt CSbcEncoderIntfcCI::GetBitpoolSize(TUint& aBitpoolSize)
       
   378     {
       
   379     aBitpoolSize = iCurrentBitpoolSize;
       
   380 
       
   381 #ifdef _DEBUG
       
   382     RDebug::Print(_L("CSbcEncoderIntfcCI::GetBitpoolSize [%d]"),
       
   383                   iCurrentBitpoolSize);
       
   384 #endif
       
   385     return KErrNone;
       
   386     }
       
   387 
       
   388 /*
       
   389  * CSbcEncoderIntfcCI::ApplyConfig
       
   390  * Commits new configutaion settings.
       
   391  * (other items were commented in a header).
       
   392  */
       
   393 EXPORT_C TInt CSbcEncoderIntfcCI::ApplyConfig()
       
   394     {
       
   395 	iCurrentSamplingFrequency = iSamplingFrequency;
       
   396 	iCurrentChannelMode       = iChannelMode;
       
   397 	iCurrentNumOfSubbands     = iNumOfSubbands;
       
   398 	iCurrentNumOfBlocks       = iNumOfBlocks;
       
   399 	iCurrentAllocationMethod  = iAllocationMethod;
       
   400 	iCurrentBitpoolSize       = iBitpoolSize;
       
   401 
       
   402 #ifdef _DEBUG
       
   403     RDebug::Print(_L("CSbcEncoderIntfcCI::ApplyConfig - SBC config applied"));
       
   404 #endif
       
   405 	return KErrNone;
       
   406     }
       
   407 
       
   408 // End of File