Problems with some VSTi's

I found out that some VSTi’s (for instance JunoX2 from ReFX) report that they don’t want MIDI messages, so:
dispatch (effCanDo, 0, 0, (void*) “receiveVstMidiEvent”, 0) = 0.

The problem is that this will cause the VSTPluginInstance to crash because the variable midiMessages will be 0 and the code will try to read from.

So, I think it would be better to call ensureMidiEventSize() with a small number if wantsMidiMessages was false. Other possibility is to check from the PluginDescription if it is an instrument and to OR that with the result from the “receiveVstMidiEvent” dispatch.

Further, the lines: case audioMasterWantMidi: wantsMidiMessages = true; break;
must be rewritten to:case audioMasterWantMidi: wantsMidiMessages = true; ensureMidiEventSize (256); break;Otherwise same problem with 0-pointer.

Maybe a better fix would just be to change line 1059 to:

ensureMidiEventSize (eventIndex + 1);

?

…because that’s where it’s supposed to be making sure that there’s enough space allocated.

Yes, that’s even better.

The variable wantsMidiMessages must also definitely be OR’ed with ((effect->flags & effFlagsIsSynth) != 0) for proper operation, because, as previously said, some VSTi’s otherwise return false when one calls acceptsMidi().
By definition, VSTi’s always must accept MIDI.