[LAD] Jack ringbuffer

Will J Godfrey WillGodfrey at musically.me.uk
Thu Dec 10 16:39:43 UTC 2015


On Thu, 10 Dec 2015 06:51:48 -0800 (PST)
Len Ovens <len at ovenwerks.net> wrote:

> On Thu, 10 Dec 2015, Will J Godfrey wrote:
> 
> > On Thu, 10 Dec 2015 09:07:25 -0500
> > Paul Davis <paul at linuxaudiosystems.com> wrote:
> >
> >> On Thu, Dec 10, 2015 at 9:04 AM, Will Godfrey <willgodfrey at musically.me.uk>
> >> wrote:
> >>
> >>> If I have a buffer size of 256 and always use a 4 byte data block, can I be
> >>> confident that reads and writes will either transfer the correct number
> >>> of bytes or none at all?
> >>>
> >>
> >>
> >> You cannot.
> >
> > Somehow I expected that would be the answer :(
> >
> > So, if I get, (say) three bytes processed, presumably I make another call for
> > just one.
> 
> You can check if there are 4 bytes available, if not don't read (yet). 
> Normally (at least for anything I have done) the reason I use the ring 
> buffer is to divorce the data processing from any real time requirement. 
> So I am reading the ring buffer in a loop, I can check how many bytes are 
> available. jack_ringbuffer_read_space(buffer) can be used I think.

I'm doing this. My main concern was whether the pointers would be updated in
byte steps or block size steps, and what implications that might have.

I'm quite prepared to believe I might be over-thinking the problem. This has
been known before :)

-- 
It wasn't me! (Well actually, it probably was)

... the hard part is not dodging what life throws at you,
but trying to catch the good bits.


More information about the Linux-audio-dev mailing list