[Jack-Devel] Avoiding spinlocks in a parallel sequencer

PrevNext  Index
DateWed, 08 Apr 2015 18:14:17 +0200
From [hidden] at mailueberfall dot de <[hidden] at mailueberfall dot de
To[hidden] at lists dot jackaudio dot org
Follow-UpMarkus Seeber Re: [Jack-Devel] Avoiding spinlocks in a parallel sequencer
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
PrevNext  Index

1428509673.17938_0.ltw:2, <trinity-ed8b1778-8a79-4231-981e-7730cd86031e-1428509657341 at 3capp-gmx-bs71>