Non exsiting named-pipe-server blocks plugin

#1

Hi, I’m new in Juce-Programming and my goal is to send the level of a track to an external display controlled by ardiuno. My first idea is/was to use a named pipe in order to send an avarage of 1 or 2 seconds to a piece of software (‘level-dispatcher’), which sends the values to the arduino.
Now I have some trouble: The plugin contains the pipe-client; the ‘level-dispatcher’ the pipe-server. The plugin blocks the audio-process, if no pipe-server exists (‘level-dispatcher’ is not started). Is that normal?

mue

#2

I suggest you to have anything that could block the audio thread in a separate thread object. You can update this object with the information you need to send to your named-pipe-server without risking to block the audio thread.

#3

Mandatory reading. Don’t block the audio thread. You’ll need a FIFO scheme to pipe data from the audio thread to a networking thread that handles communication. You can use the AbstractFifo class to make a “bounded SPSC queue” which solves the problem.

#4

Thank you very much for that hint. Will try out the fifo immediatly. The fifo will be written in the audio-process-block and will be read in the timer-block. That means, both (audio and timer) runs definitely in different threads, right?

#5

That means, both (audio and timer) runs definitely in different threads, right?

Yes. Just be aware that with bounded FIFOs things can get hairy if the reader index passes the writer, so you may also want to add a check for isNonRealTime() in your prepareToPlay function.