asb2m10 / dexed

DX7 FM multi plaform/multi format plugin
GNU General Public License v3.0
2.79k stars 242 forks source link

MPE keeps turning off #431

Open Yzrsah opened 2 months ago

Yzrsah commented 2 months ago

I developed a habit of re-opening Dexed windows constantly to open the PARM window and check if MPE has been turned off. For some reason, MPE turns off...randomly? I'm using Bitwig 5.x and it's always been 5 minutes, or a few hours later, a day later, a deactivate/reactivate? a file reload, or some kind of event...at whatever time, for whatever reason, Dexed's MPE is turned off. After opening the PARM window to check this probably 500 times I realize I should try to resolve this.

Yzrsah commented 2 months ago

Looks like PluginProcessor.cpp lines 474-478

if( voices[note].keydown && voices[note].channel == channel )
{
    // If we get two keydowns on the same channel we are getting information from a non-mpe device
    controllers.mpeEnabled = false;
}

The MPE Specification says:

When there are more Notes than unoccupied Channels, a new note must share a MIDI Channel with an
existing note. Since Control Change and Pitch Bend are Channel Messages, they then affect both notes on
that Channel.

Since the MPE spec allows note sharing, you should not disable MPE if shared notes are detected.

Though I wasn't actually doing this. Maybe it was a mistake in some of the note FX plugins or Grids I use. And I was wiring something up in Note Grid and suddenly Dexed's MPE turns off and the patch sounds corrupted because the pitch bend ranges and channels are wrong. It maybe related to event ordering, Bitwig has a few bugs with event ordering for I.e. CLAP_EVENT_NOTE_EXPRESSION, there are multiple duplicates with time-jittered values that come in @ event->time == 0;