[linux-audio-dev] libsamplerate question
Erik de Castro Lopo
mle+la at mega-nerd.com
Mon Jan 23 23:56:20 UTC 2006
David wrote:
> 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 ?
The most you should ever loose is one sample. In addition, src_simple
will not write beyond the length of the output buffer length that
you specify in the output_frames field.
Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo
+-----------------------------------------------------------+
"I invented the term Object-Oriented, and I can tell you I
did not have C++ in mind." -- Alan Kay
More information about the Linux-audio-dev
mailing list