[linux-audio-dev] libsamplerate question

From: David <dplist@email-addr-hidden>
Date: Tue Jan 24 2006 - 00:33:22 EET

Hello everybody !

I've just added a resampling function to my code thanks to the
excellent work of Erik de Castro Lopo (thanks a lot !). Combined with
libsndfile (thanks again) it is really easy to load any sound file I
want. But I'd like to make sure I'm using it correctly.

I process my input data in one pass using src_simple() and I have to
compute the length of the output data buffer beforehand. So I did
somehting like this :

out_len = (long int) ceil((double) in_len * ratio);

It seems that my output buffer is always one frame too big (I checked
this by reading the output_frames_gen field of the SRC_DATA structure
after the processing is done).

Is it safe to assume that using floor() instead of ceil() will not lead
to a too short output buffer in some cases ?

I can live with wasting a malloced float but I'd like to be sure it
cannot be done in a prettier way.

Thanks.

-- 
David
Received on Tue Jan 24 04:15:04 2006

This archive was generated by hypermail 2.1.8 : Tue Jan 24 2006 - 04:15:06 EET