Automatically connect instances

Hi there,

is it possible that multiple instances of a Juce audio plugin added on different channels in a DAW project can see each other and use the other channel’s audio signals?
Example: Channel A and B have both been added an instance of a VST plugin created with Juce and the user now wants to see the spectrum or oscilloscope of both audio signals in the plugin instance of channel B, stacked, summed or whatever.
So the task would be that all added instances probably would constantly need to listen to other instances around (added or deleted) and update their own GUI accordingly.

Thanks for any hints.

It’s definitely doable, as I’ve seen it done. I think the immediate caveats are going to be things like synchronisation. The information you get from another instance may be out of date, so attempting to actually playback audio from another instance will surely be a no-go (right?).

The way this will need to work is something along the lines of some shared static structure perhaps created as a shared resource pointer, where each new instance can enroll itself with a uuid. From there each instance will probably push some data once per block in a fifo style queue. Then the concerned instances can pull. You might then require a way of also registering which uiids are using which, so you know when they are all done reading before you mark the data to be cleared.

I’m just spitballing here, it’s not something I’ve done, but it’s an interesting proposition.

Thanks a lot.
Perhaps it’s not needed to sync audio with all other instances but only the graphical representation of it the plugin shall visualize.
But it’s definitely a challenge, you’re right.

Just to confirm what @Fandusss said: you cannot get the current processBlock buffer from an other instance. This is because DAWs can make your instances run in parallel, in different processes, and in whatever order.

So as long as you are fine reading outdated data (from the previous processBlock call - meaning introducing at least a buffer of latency), you should be fine.

I guess i’m fine with that, as long as i’m able to sync the data from other instances with the one the user has opened, since it’s about analysing this graphical data summed, stacked, etc., and therefore the timepoints have to match in order to have correct visualized data.