os/mm/mmlibs/mmfw/inc/mmf/utils/rateconvert.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/inc/mmf/utils/rateconvert.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,68 @@
     1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// include\mmf\utils\rateconvert.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef RATECONVERT_H
    1.22 +#define RATECONVERT_H
    1.23 +
    1.24 +/**
    1.25 +@internalTechnology
    1.26 +@file
    1.27 +*/
    1.28 +
    1.29 +#include <e32base.h>
    1.30 +
    1.31 +/**
    1.32 +Base utility class to change the sample rate of audio data in a buffer
    1.33 +*/
    1.34 +class CChannelAndSampleRateConverter : public CBase
    1.35 +	{
    1.36 +protected:
    1.37 +	CChannelAndSampleRateConverter();
    1.38 +	
    1.39 +public:
    1.40 +	/*
    1.41 +	Create a converter that will do rate and channel conversion as requested
    1.42 +	*/
    1.43 +	IMPORT_C static CChannelAndSampleRateConverter* CreateL(TInt aFromRate,TInt aFromChannels,
    1.44 +												 TInt aToRate,TInt aToChannels);
    1.45 +	/**
    1.46 +	Reads the audio data from the source buffer,
    1.47 +	converts the number of channels and the sample rate
    1.48 +	and copies the result to the destination buffer
    1.49 +
    1.50 +	@param  aSrcBuffer
    1.51 +	        The source buffer containing the audio data to convert.
    1.52 +	@param  aDstBuffer
    1.53 +	        The destination buffer - assumed big enough
    1.54 +
    1.55 +	@return The length of the source buffer that was consumed.
    1.56 +	*/
    1.57 +	virtual TInt Convert(const TDesC8& aSrcBuffer, TDes8& aDstBuffer)=0;
    1.58 +	virtual void Reset()=0;
    1.59 +
    1.60 +	/*
    1.61 +	Indicates what buffer size is required to hold the converted data.
    1.62 +	Support size of original buffer. 
    1.63 +	aRoundUpToPower means give next power of 2 size up from raw size.
    1.64 +	NB. May be bigger than strictly necessary.
    1.65 +	*/
    1.66 +	virtual TInt MaxConvertBufferSize(TInt aSrcBufferSize, TBool aRoundUpToPower=EFalse)=0;
    1.67 +	};
    1.68 +
    1.69 +
    1.70 +#endif
    1.71 +