[LAD] jack_ringbuffer or port_buffer ?

Gabriel M. Beddingfield gabriel at teuton.org
Mon May 18 13:45:25 UTC 2009

Hi Hermann,

On Mon, May 18, 2009 8:31 am, hermann meyer wrote:
>> they are totally unrelated.
> do I get it right, so, if there is no other thread then the
> process_callback involved in the midi data collection,then there is no
> need to use the ringbuffer ?

A ringbuffer is like an array that never ends.  It's like a C++
std::vector<> or std::list<>.  It's a container that you can use if you
want a never-ending array where the memory is pre-allocated.  The
ringbuffer in jack could be used in any program, anywhere.  Here is a
Wikipedia article on the subject:


You would use a ringbuffer when you have an audio (real-time) thread that
MUST NOT wait... but you need to share data with a GUI thread or some
other thread that will do heavy processing.

JACK does not require, nor does it even expect, that you will have a
ringbuffer anywhere in your application... even if you have more than one
thread.  If you use an normal array/buffer for transferring data, that
will be just fine as long as you have appropriate read/write controls.

On the other hand, a port_buffer is just the interface you use from JACK
to read/write data from/to the JACK bus.  It is owned and operated by
JACK, so you don't have to allocate it, nor worry about whether it's a
ring buffer or some other kind of buffer.

Hope this helps,

               G a b r i e l   M   B e d d i n g f i e l d

More information about the Linux-audio-dev mailing list