[linux-audio-dev] libsamplerate question
David
dplist at free.fr
Mon Jan 23 22:33:22 UTC 2006
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
More information about the Linux-audio-dev
mailing list