I’ve been working on a VST which generates midi. I had been planning to use midi channels to distribute midi within the DAW, however, when I attempted to do this in Ableton Live, it became clear that it isn’t possible to route midi channels from one track to another. I can only route all midi from one track to another.
This led to the idea of using multiple instance of my VST, each with their own midi buffer, so that each instance can control different instruments.
I was able to load multiple instances of my VST, but their midi-buffers don’t seem to be discrete. One instance seems to over-write the other.
Is there some mechanism by which each instance can have it’s own discrete midi buffers?
-
The MIDI channel limitation is an Ableton limitation. If you use Cubase or Reaper, for example, you can output different MIDI channels out of a plugin.
-
You can share objects between instances using static variables or something like juce::SharedResourcePointer.
However, bear in mind that if you’re planning to do some real time processing and write to the shared buffer, you will likely have to deal with sync issues, as the order of calls to different instances isn’t guaranteed - the host might even run all your different instances at the same time on different threads.
Many thanks for your response.
- Glad to hear this, the two DAWs I tried did not allow this (Live + Waveform). I grabbed FL Studio to see if it was an issue there as well, but haven’t yet had time to test it. Looks like I need to purchase Reaper.
- My question is actually how to accomplish the opposite of this. I don’t want to share a midi buffer between instances. I want each instance to have it’s own. In the default plugin setup, VST instances seem to be sharing the buffer, which is what I’m looking to avoid.
As I wrote that, and reflecting on your response, there is a good chance I borked this myself by using a SharedResourcePointer to manage my state. I’ll try re-writing things without it and see if the two instances still interfere with one another.
Instances are not sharing any members by default unless you made them static.
The only way one instance would be writing into the buffer of another instance would be if you routed one into the other in the DAW.
Indeed, I am the culprit! I think I meant to use a scoped pointer rather than a shared resource pointer. Now that I’ve switched over, no more interference and I can call up multiple instances and route them separately in Live. Many thanks!
1 Like