size_t pos = (size_t) (i*f);
size_t pos = (size_t) (i*ratio);
static	void resample(uint8 *sourcedata,uint8 **destdata,size_t sourcelen,size_t *destlen,int current_rate,int wanted_rate){	// I have no idea what I'm doing here - Dancer	// This is really Breshenham's line-drawing algorithm in	// a false nose, and clutching a crude smoothing loop.	float	f=wanted_rate/current_rate;	*destlen = (unsigned int) ((sourcelen*f)+1);	if(!*destlen||current_rate==wanted_rate)		{		// Least work		*destlen=sourcelen;		*destdata=new uint8[sourcelen];		memcpy(*destdata,sourcedata,sourcelen);		return;		}	*destdata=new uint8[*destlen];	size_t last=0;	for(size_t i=0;i<sourcelen;i++)		{		size_t pos = (size_t) (i*f);		assert(pos<=*destlen);		(*destdata)[pos]=sourcedata[i];		// Interpolate if need be		if(last!=pos&&last!=pos-1)			for(size_t j=last+1;j<=pos-1;j++)				{				unsigned int x=(unsigned char)sourcedata[i];				unsigned int y=(unsigned char)sourcedata[i-1];				x=(x+y)/2;				(*destdata)[j]=(uint8) x;				}		last=pos;		}	cerr << "End resampling. Resampled " << sourcelen << " bytes to " << *destlen << " bytes" << endl;}