Filtering out MIDI events in a tracktion plugin

Hi,
I’m starting out with Tracktion, and trying to implement an internal MIDI plugin for doing live quantization.

I’m only experimenting right now, and just trying to implement helper functions to filter out some midi events in the MidiMessageArray passed to my applyToBuffer (const te::AudioRenderContext& fc) function.

I’m having trouble accessing elements in MidiMessageArray, to inspect them:

void QuantizerPlugin::applyToBuffer (const te::AudioRenderContext& fc)
{
if (fc.bufferForMidiMessages != nullptr)
{
    removeNoteOffs(fc.bufferForMidiMessages);
    // ...
}
}

and

void QuantizerPlugin::removeNoteOffs(te::MidiMessageArray* messages)
{
    for (int i=messages->size()-1; i > -1; --i)
    {
        if (  /* how can I inspect event at index i, to know if it is a noteOff ?*/  )
            messages->remove(i);
    }
}

I feel pretty dumb, it seems like the answer should be obvious, but I missed it. how can I inspect the note properties at index i the MidiMessageArray?

Ok nevermind, I found the syntax in the code base :

void QuantizerPlugin::removeNoteOffs(te::MidiMessageArray* mma)
{
        for (int i = mma->size(); --i >= 0;)
        {
            auto& m = (*mma)[i];

            if (m.isNoteOff())
            {
                mma->remove (i);
            }
        }
}