MIDI: what events should a VST process?

Active sensing?

All Notes Off? All Sound Off?

Sysex?

Time Code?

Song Position?

Time clock?

Sequence start/continue?

Reset?

Do I need to pay attention to channel or can I assume all input is meant for me? (As a start I’m doing traditional MIDI, not the pattern where each note of a polyphonic performance is transmitted over a separate MIDI channel so each note can have it’s own MIDI controllers.)

Does Juce always supply a “running status” byte one even if the raw MIDI stream doesn’t have one? For instance on Windows, if the incoming stream ust has 1 byte saying NoteOn then has a string of notes, the API will give you each note (byte 2/3) with a fake byte 1, so you don’t have to handle that case.

Do program changes come to a VST via MIDI? If so how do people handle the mapping of number to name?

As far as I know, all MIDI events are transmitted to a VST and can be read in the processBlock method of your plugin processor.

Then you can check what they contain using the MidiMessage class. You should check it in the documentation : JUCE: MidiMessage Class Reference

You should implement a simple loop on incoming messages and log what you see to check if you receive all the messages you intend to.

void PluginProcessor::processBlock (juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiMessages)
{
    for (const auto metadata: midiMessages)
    {
        const auto m = metadata.getMessage();
        DBG(m.getChannel());
        DBG(m.isNoteOnOrOff());
        // etc.
    }
    // Whatever else you have to do here...
}

Thanks. Yes, that’s pretty much what I did. I already had code from another project that worked with raw MIDI so I’m trying it here as is but it will take some time to connect in completely.

Say, I have a series of MIDI NoteOn messages, using the special “NoteOn with velocity 0” meaning note-off.

That special message existed because in 1980 memory was so expensive that being able to just send the “Channel 1 Note-On” byte ONCE, followed by an entire performance of just note-ons and off, cut memory usage 33%. You only see byte 2 (note) and byte 3 (velocity), 2&3, 2&3, and so on.

Now with Microsoft’s multimedia library, if you’re getting that MIDI stream they’ll give you the “Channel 1 Note-On” first byte every time, even though the raw stream doesn’t have it.

Likewise, all the methods you describe will surely give the right results.

But my question is: will pmm->getRawData()[0] always show me the “Channel X Note-On” type message for each note in the sequence? Or for the second and succeeding notes will it only show me the byte-2 of the message?