Re: [linux-audio-dev] libsamplerate question

From: Erik de Castro Lopo <mle+la@email-addr-hidden-nerd.com>
Date: Tue Jan 24 2006 - 01:56:20 EET

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
Received on Tue Jan 24 04:15:10 2006

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