mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioResource.cpp
changeset 0 71ca22bcf22a
child 7 709f89d8c047
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 provides the main API for the Advanced Audio Controller
       
    15 *				 Resource.  This class is the base class for the specific codec resource
       
    16 *				 classes.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include	"AdvancedAudioResource.h"
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CAdvancedAudioResource::CAdvancedAudioResource
       
    29 // C++ default constructor can NOT contain any code, that
       
    30 // might leave.
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 EXPORT_C CAdvancedAudioResource::CAdvancedAudioResource()
       
    34 	:	iResourceBuf(NULL),
       
    35 		iResourceOpen(EFalse)
       
    36     {
       
    37     }
       
    38 
       
    39 // Destructor
       
    40 EXPORT_C CAdvancedAudioResource::~CAdvancedAudioResource()
       
    41 	{
       
    42 	iCodecConfigParams.Close();
       
    43 
       
    44 	if ( iResourceOpen )
       
    45 		{
       
    46 		delete iResourceBuf;
       
    47 		iResourceFile.Close();
       
    48 		iFs.Close();
       
    49 		}
       
    50 	}
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CAdvancedAudioResource::PropertiesL
       
    54 // Returns the controller's properties for the current Codec.
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 EXPORT_C const TAapProperties& CAdvancedAudioResource::PropertiesL()
       
    58 	{
       
    59 	return iProperties;
       
    60 	}
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CAapResourceAMRDecoder::ConfigurationParametersL
       
    64 // Returns the configuration parameters for AMR Decoder.
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 EXPORT_C const RArray<TInt>& CAdvancedAudioResource::CodecConfigParametersL()
       
    68 	{
       
    69 	return iCodecConfigParams;
       
    70 	}
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // CAdvancedAudioResource::ReadResourceFileL
       
    74 // Reads the data from the resource file for the specified codec.
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 EXPORT_C void CAdvancedAudioResource::ReadResourceFileL(
       
    78 	const TDesC& aResourceFileName,
       
    79 	TInt aResourceId )
       
    80 	{
       
    81 	iResourceOpen = ETrue;
       
    82 	// Connect to the file server
       
    83 	User::LeaveIfError(iFs.Connect());
       
    84 	// Open the resource file
       
    85 	iResourceFile.OpenL(iFs, aResourceFileName);
       
    86 
       
    87 	iResourceBuf = iResourceFile.AllocReadL(aResourceId);
       
    88 	iResourceReader.SetBuffer(iResourceBuf);
       
    89 
       
    90 	iProperties.iSharedBufferMaxNum = iResourceReader.ReadInt32();
       
    91 	iProperties.iSharedBufferMaxSize = iResourceReader.ReadInt32();
       
    92 	iProperties.iSamplingRate = iResourceReader.ReadInt32();
       
    93 	iProperties.iStereoSupport = iResourceReader.ReadInt32();
       
    94 	iProperties.iMetaDataSupport = iResourceReader.ReadInt32();
       
    95 
       
    96 	ReadCodecConfigParametersL();
       
    97 
       
    98 	// Cleanup
       
    99 	delete iResourceBuf;
       
   100 	iResourceBuf = NULL;
       
   101 	iResourceFile.Close();
       
   102 	iFs.Close();
       
   103 	iResourceOpen = EFalse;
       
   104 	}
       
   105 
       
   106 //  End of File