This seems to be a thing that would be implemented on the host’s side. (The plugin would just have additional inputs and the host will allow routing different tracks into that input etc.) If your host of choice doesn’t allow that, you are pretty much out of luck. Plugin formats don’t really have facilities to query and manipulate the host’s tracks and routings between them.
Okay
The host i use (ableton live) allows one input per audio channel (audio is being mixed together if you route several to the same channel). And i believe it is the same for most hosts.
So that’s not a solution
What i could do is create a “sender” plugin that takes audio of one channel and sends it to my plugin. How does that sound ?
Does anyone have any ressource or links to do this ?
I think he wants something much more complicated than just a plugin with a single sidechain input…(Trying to workaround issues in the host with its routing/sidechain implementation.)
Let’s say that i go for the solution of the link above : I take advantage of the fact that several instances of the same plugin share the same adress space. I use static variables to store the signals buffers, so loading my plugin on a track is how my routing is made.
What are the multithreading issues i can encounter ? What precautions shall i take ?
You’re going to have a hard time then. Your two instances could be running in different sandboxes, or even if they’re in the same process, there’s no guarantee that during each process block their callback methods will happen in the same order.
e.g. in many hosts (certainly in Tracktion this is true) there’ll be a thread pool / work queue where parallel CPU cores pull the next item to process. So the order in which two plugins get their process callbacks executed is definitely not something you can rely on to stay constant. So it’s not possible to just pass a block from one instance to the next each time, you’d need to build in fifos and other nastiness to stream the audio, adding latency.
Kontakt uses a “Kontakt Memory Server” app if you don’t want to load the samples into a plugin instance. Maybe have a look at how that whole system works. it’s a separate application entirely from the DAW that loads samples into RAM and holds them there, even if you quit the DAW/remove the plugin. So, somehow they are able to get every instance of Kontakt to talk to this one Memory Server which provides the samples to the Kontakt Plugins that are running in your DAW:
My point is that there is way to pass messages from DAW plugins to applications outside the DAW, and then for those applications to send messages (sample data in this case) to those Plugins.