[Jack-Devel] Avoiding spinlocks in a parallel sequencer

Markus Seeber markus.seeber at spectralbird.de
Wed Apr 8 21:52:57 CEST 2015


On 04/08/2015 06:14 PM, johannes89 at mailueberfall.de wrote:
> 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
> _______________________________________________
> Jack-Devel mailing list
> Jack-Devel at lists.jackaudio.org
> http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
> 

I try to understand your plan:

simple data flow example:

zynaddsubfx_1_output
          |
          V
sequencer_client_1_input
          |
          V
sequencer_input_ringbuffer
          |
          V
(sequencer processing stuff)
          |
          V
sequencer_output_ringbuffer
          |
          V
sequencer_client_output
          |
          V
system_client_input(hardware output)

Could you explain the dataflow you are planning in some kind of...
picture? Maybe also what you envision to happen in which thread or which
callback? I am quite unsure how your vision for this looks like, or how
the interface between JACK and your sequencer is supposed to behave.

Do you want to do some signal processing in your sequencer or would it
be ok to delegate this to other jack clients? (may be easier)



More information about the Jackaudio mailing list