[LAD] Realtime inter-thread communication

Will Godfrey willgodfrey at musically.me.uk
Mon Feb 29 16:53:39 UTC 2016


On Mon, 29 Feb 2016 07:27:45 -0800 (PST)
Len Ovens <len at ovenwerks.net> wrote:

> On Mon, 29 Feb 2016, Sebastian Gesemann wrote:
> 
> > I've started writing a software synthesizer in C++ (using SDL2 for
> > now) for kicks and giggles and ran into the problem of having the
> > event loop thread that listens for keyboard events communicate with
> > the audio callback.
> >
> > Are there any recommendations for how to pass real-time events (note
> > on, note off, etc) to such an audio callback? I figured, this is
> > already a solved problem and that I could benefit from your
> > experiences. Maybe you know of some nice open-source C++ queue
> > implementation that is suitable in such a situation.  
> 
> I have used jackd ringbuffer for that.
> 
> If you don't want to link against jack you could probably pull the code 
> out to use in your application. the ring buffer is a polled setup, so 
> every time you do some audio processing you need to check the ring buffer 
> to see if there are any new bytes to process.
> 
> --
> Len Ovens
> www.ovenwerks.net
Another vote for jack ringbuffer. I've found it very reliable and easy to
implement.

-- 
Will J Godfrey
http://www.musically.me.uk
Say you have a poem and I have a tune.
Exchange them and we can both have a poem, a tune, and a song.


More information about the Linux-audio-dev mailing list