# Extending MidiMessage::noteOffObject

**URL:** <https://forum.juce.com/t/extending-midimessage-noteoffobject/17017>\
**Category:** General JUCE discussion\
**Created:** [March 25, 2016, 11:04pm UTC](https://forum.juce.com/t/extending-midimessage-noteoffobject/17017 "2016-03-25T23:04:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_pi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/_pi/32/527_2.png) [@\_pi](https://forum.juce.com/u/_pi)\
**Post date:** [March 25, 2016, 11:04pm UTC](https://forum.juce.com/t/extending-midimessage-noteoffobject/17017/1 "2016-03-25T23:04:16Z")

</div>

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&nbsp; 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...

π

---

<div class="post-metadata">

**Author:** ![matkatmusic](https://avatars.discourse-cdn.com/v4/letter/m/dfb087/32.png) [@matkatmusic](https://forum.juce.com/u/matkatmusic)\
**Post date:** [March 29, 2016, 3:00am UTC](https://forum.juce.com/t/extending-midimessage-noteoffobject/17017/2 "2016-03-29T03:00:36Z")

</div>

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

&nbsp;

When you resize regions in a DAW, often times you'll cut off CC messages. &nbsp; &nbsp;When you merge these resized regions together, you end up with a couple CC64:0 or CC64:127 messages in sequence. &nbsp;they don't hurt anything. &nbsp; 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. &nbsp;also Pedal messages are CC messages, not note messages. &nbsp; they're an entirely different type of data compared to note messages. &nbsp; 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. &nbsp;However, because they are Continuous Controller messages, there is nothing that says they can't be anywhere between 0 and 127. &nbsp;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&nbsp;pedal). &nbsp;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. &nbsp;the in-between values are disregarded. &nbsp;

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