mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/amraudiorecordcontroller/Src/AMRAudioRecordControllerResource.cpp
changeset 0 71ca22bcf22a
child 18 2eb3b066cc7d
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2 * Copyright (c) 2004 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:  This class implements resource file handling for AMR RecordControllerPlugin.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include	<AMRAudioRecordControllerResource.rsg>
       
    22 #include	"AMRAudioRecordControllerResource.h"
       
    23 #include 	<data_caging_path_literals.hrh>
       
    24 
       
    25 // LOCAL CONSTANTS AND MACROS
       
    26 
       
    27 _LIT(KDirAndFile,"z:AMRAudioRecordControllerResource.rsc");
       
    28 
       
    29 // ============================ MEMBER FUNCTIONS ===============================
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CAMRAudioRecordControllerResource::CAMRAudioRecordControllerResource
       
    33 // C++ default constructor can NOT contain any code, that
       
    34 // might leave.
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 CAMRAudioRecordControllerResource::CAMRAudioRecordControllerResource()
       
    38     {
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CAMRAudioRecordControllerResource::NewL
       
    43 // Two-phased constructor.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 CAMRAudioRecordControllerResource* CAMRAudioRecordControllerResource::NewL()
       
    47 	{
       
    48 #ifdef _DEBUG
       
    49 	RDebug::Print(_L("CAMRAudioRecordControllerResource::NewL"));
       
    50 #endif
       
    51 	CAMRAudioRecordControllerResource* self = new(ELeave) CAMRAudioRecordControllerResource();
       
    52 	CleanupStack::PushL(self);
       
    53 	self->ConstructL();
       
    54 	CleanupStack::Pop(self); // self
       
    55 	return self;
       
    56 	}
       
    57 
       
    58 // Destructor
       
    59 CAMRAudioRecordControllerResource::~CAMRAudioRecordControllerResource()
       
    60 	{
       
    61 	iSupportedBitRates.Close();
       
    62 	iSupportedSampleRates.Close();
       
    63 	}
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CAMRAudioRecordControllerResource::ConstructL
       
    67 // Symbian 2nd phase constructor can leave.
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 void CAMRAudioRecordControllerResource::ConstructL()
       
    71 	{
       
    72 #ifdef _DEBUG
       
    73 	RDebug::Print(_L("CAMRAudioRecordControllerResource::ConstructL"));
       
    74 #endif
       
    75 
       
    76 	TParse* fp = new(ELeave) TParse();
       
    77 	fp->Set(KDirAndFile, &KDC_RESOURCE_FILES_DIR, NULL);
       
    78 	ReadResourceFileL(fp->FullName(), AMRENCODER);
       
    79 	delete fp;
       
    80 	}
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // CAMRAudioRecordControllerResource::SupportedSampleRatesL
       
    84 // Returns the supported sample rates.
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 const RArray<TUint>& CAMRAudioRecordControllerResource::SupportedSampleRatesL()
       
    88 	{
       
    89 	return iSupportedSampleRates;
       
    90 	}
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CAMRAudioRecordControllerResource::SupportedBitRatesL
       
    94 // Returns the supported bit rates.
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 const RArray<TUint>& CAMRAudioRecordControllerResource::SupportedBitRatesL()
       
    98 	{
       
    99 	return iSupportedBitRates;
       
   100 	}
       
   101 
       
   102 // -----------------------------------------------------------------------------
       
   103 // CAMRAudioRecordControllerResource::ReadCodecConfigParametersL
       
   104 // Reads the configuration parameters for AMR Decoder.
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 void CAMRAudioRecordControllerResource::ReadCodecConfigParametersL()
       
   108 	{
       
   109 #ifdef _DEBUG
       
   110 	RDebug::Print(_L("CAMRAudioRecordControllerResource::ReadCodecConfigParametersL"));
       
   111 #endif
       
   112 	iCodecConfigParams.Append( iResourceReader.ReadInt32() );	// Encoding Mode
       
   113 	iCodecConfigParams.Append( iResourceReader.ReadInt32() );	// DTX Flag
       
   114 
       
   115 	TInt number = iResourceReader.ReadInt16();
       
   116 	for ( TInt i = 0; i < number; i++ )
       
   117 		{
       
   118 		iSupportedBitRates.Append( iResourceReader.ReadInt32() );	// Bit Rate
       
   119 		}
       
   120 	number = iResourceReader.ReadInt16();
       
   121 	for ( TInt i = 0; i < number; i++ )
       
   122 		{
       
   123 		iSupportedSampleRates.Append( iResourceReader.ReadInt32() );	// Sample Rate
       
   124 		}
       
   125 	}
       
   126 
       
   127 //  End of File