[Jack-Devel] Avoiding spinlocks in a parallel sequencer

johannes89 at mailueberfall.de johannes89 at mailueberfall.de
Wed Apr 8 18:14:17 CEST 2015


Hello,

currently, I am trying to write a sequencer which should be able to contain 40 or more instances of zynaddsubfx, plus some effects. zynaddsubfx outputs data using jack, so for each zynaddsubfx, I'll add a jack client with two ports each, and a ringbuffer. These clients will simply forward zyn's output to the respective ringbuffer.

So far (using jack2 at least), we end up in a parallelized setup. The problem is that I would like the sequencer to output it's final sound via jack, too. So the sequencer gets one more jack client, which is connected to the sequencer's out ports. This client must call process() to do everything except feeding the ringbuffers, e.g.:

 * computing simple effects, like lfo generation, lfo transformation, ...
 * sending control parameters *to* zynaddsubfx
 * post-process zyn's audio data by reading the ringbuffers

However, the last points is an issue. If there's nothing to read, I'll need to use a spinlock to wait for zynaddsubfx. Even if that spinlock is atomic-based and lock-free (I think it should be RT safe then), this will cause many unused CPU cycles.

Does anyone have a better idea than using spinlocks?

Thanks + kind regards,
Johannes



More information about the Jackaudio mailing list