mmlibs/mmfw/src/utils/audioutils/rateconvert.cpp
branchRCL_3
changeset 50 948c7f65f6d4
parent 49 735348f59235
child 41 f7bf1ed8db72
equal deleted inserted replaced
49:735348f59235 50:948c7f65f6d4
   217 TInt CChannelAndSampleRateConvert::SizeOfUpsampleBuffer(TInt aBufferLength)
   217 TInt CChannelAndSampleRateConvert::SizeOfUpsampleBuffer(TInt aBufferLength)
   218 	{
   218 	{
   219 	TInt rawValue = aBufferLength;
   219 	TInt rawValue = aBufferLength;
   220 	ASSERT(iFromRate < iToRate); // should not be called otherwise
   220 	ASSERT(iFromRate < iToRate); // should not be called otherwise
   221 	// upsample - will generate more data. use floats to avoid extra round error
   221 	// upsample - will generate more data. use floats to avoid extra round error
   222 	rawValue = TInt(rawValue * TReal(iToRate) / TReal(iFromRate) + 0.5) + 4*sizeof(TInt16); // add some buffer extra buffer
   222 	rawValue = TInt(rawValue * TReal(iToRate) / TReal(iFromRate) + 0.5) + 4*sizeof(TInt16); // add some fudge factor just in case
   223 	rawValue = NextPowerUp(rawValue); // when upscaling always give nice power
   223 	rawValue = NextPowerUp(rawValue); // when upscaling always give nice power
   224 	return rawValue;	
   224 	return rawValue;	
   225 	}
   225 	}
   226 
   226 
   227 //
   227 //