Question

I've made a VST2.4 instrument in C++ and everything is working fine, but if I load my instrument in several channels in the host they all play each others midi files. If I copy my dll and change the name of the copy of the dll, then I can load two instances and play them separately like they should. But as long as I load multiple of the same dll they all play the same midi.

In my dll when processing midi events I do ignore channels and I'm just processing notes, and this is the only part of my code that I can think of that could be causing this. Is there something I need to know to make it work with multiple instances of the same VST instrument?

The midi event function that I'm using is taken from the synth sample included with the VST.SDK V2.4

for (VstInt32 i = 0; i < ev->numEvents; i++)
{
if ((ev->events[i])->type != kVstMidiType)
 continue;

VstMidiEvent* event = (VstMidiEvent*)ev->events[i];
char* midiData = event->midiData;
VstInt32 status = midiData[0] & 0xf0;   // ignoring channel
if (status == 0x90 || status == 0x80)   // we only look at notes
{
  ...

I know it doesn't have to do with the unique ID.

Regards, Morgan

Was it helpful?

Solution

Check your global/static variables. That is the only way you can share state between instances (same dll).

Did you test it with another host/DAW? Could be a bug in the host - although not very likely.

Hope it helps, Marc

(Author of VST.NET and MIDI.NET)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top