[LAD] Jack ring buffer (again)

Hanspeter Portner dev at open-music-kontrollers.ch
Sat May 14 08:47:05 UTC 2016

On 14.05.2016 09:18, Will Godfrey wrote:
> I'm not sure if this has been covered before...

Similar questions seem to come up every couple of months.

> While I understand that generally you can't be certain of writing or reading
> all bytes in a block of data in one call, what about the specific case where
> you *always* read and write the same number of bytes and the buffer is an exact
> multiple of this size.
> e.g data block is 5 bytes & buffer size is 75 bytes.
> No I'm not intending to use such an example, I just want to cover worst case :)
> If that doesn't work, what about the case when you are always working in
> powers of 2?
> e.g data block is 16 bytes & buffer size is 1024 bytes.

libjack *always* allocates a buffer of size (2^x).

*but* 1 byte is reserved to discriminate between *empty* and *full* 
state of the buffer, the usable size of ringbuffer thus is actually (2^x 
- 1).


More information about the Linux-audio-dev mailing list