sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // include\mmf\utils\rateconvert.h sl@0: // sl@0: // sl@0: sl@0: #ifndef RATECONVERT_H sl@0: #define RATECONVERT_H sl@0: sl@0: /** sl@0: @internalTechnology sl@0: @file sl@0: */ sl@0: sl@0: #include sl@0: sl@0: /** sl@0: Base utility class to change the sample rate of audio data in a buffer sl@0: */ sl@0: class CChannelAndSampleRateConverter : public CBase sl@0: { sl@0: protected: sl@0: CChannelAndSampleRateConverter(); sl@0: sl@0: public: sl@0: /* sl@0: Create a converter that will do rate and channel conversion as requested sl@0: */ sl@0: IMPORT_C static CChannelAndSampleRateConverter* CreateL(TInt aFromRate,TInt aFromChannels, sl@0: TInt aToRate,TInt aToChannels); sl@0: /** sl@0: Reads the audio data from the source buffer, sl@0: converts the number of channels and the sample rate sl@0: and copies the result to the destination buffer sl@0: sl@0: @param aSrcBuffer sl@0: The source buffer containing the audio data to convert. sl@0: @param aDstBuffer sl@0: The destination buffer - assumed big enough sl@0: sl@0: @return The length of the source buffer that was consumed. sl@0: */ sl@0: virtual TInt Convert(const TDesC8& aSrcBuffer, TDes8& aDstBuffer)=0; sl@0: virtual void Reset()=0; sl@0: sl@0: /* sl@0: Indicates what buffer size is required to hold the converted data. sl@0: Support size of original buffer. sl@0: aRoundUpToPower means give next power of 2 size up from raw size. sl@0: NB. May be bigger than strictly necessary. sl@0: */ sl@0: virtual TInt MaxConvertBufferSize(TInt aSrcBufferSize, TBool aRoundUpToPower=EFalse)=0; sl@0: }; sl@0: sl@0: sl@0: #endif sl@0: