Extending MidiMessage::noteOffObject


It would be tidy if MidiMessageSequence::updateMatchedPairs() also matched every Pedal-Down message with its corresponding Pedal-Up.

The only problem I can see is that MidiMessage::noteOffObject would then no longer be correctly named.

If the name were complementingMessage or twin, that would work. In fact, wouldn't it make sense if also the note/pedal Off message could link  to its corresponding On message?

I think using:

union {
    MidiMessage* noteOffObject;
    MidiMessage* twin;

...would allow updating the name without breaking existing code.

However I can't see how to get the compiler to give a deprecation warning whenever noteOffObject is used...



Pedal messages are Continuous Controller messages.  they're not switch messages like NoteOn/Off messages. 


When you resize regions in a DAW, often times you'll cut off CC messages.    When you merge these resized regions together, you end up with a couple CC64:0 or CC64:127 messages in sequence.  they don't hurt anything.   You have to remember that most midi regions are being created in a DAW where editing can cause these overlaps to occur in the midi data.  also Pedal messages are CC messages, not note messages.   they're an entirely different type of data compared to note messages.   It just so happens that Sustain Messages are usually only interpretted as ON/OFF (127/0) because the foot pedals that create them are just on/off switches.  However, because they are Continuous Controller messages, there is nothing that says they can't be anywhere between 0 and 127.  Lots of folks happen to use Volume Pedals as sustain pedals because they couldn't get access to one and already had a volume pedal (aka CC pedal).  if you look at the output of those pedals in a DAW, you'll see that they only trigger the sustain On/Off effect when they're at either extreme.  the in-between values are disregarded.  

if your midi files are causing stuck notes, open them up in a DAW and draw in the missing CC64:0 messages.