asb2m10 / dexed

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

MPE keeps turning off #431

Open Yzrsah opened 4 months ago

Yzrsah commented 4 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 4 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;

gustebeast commented 2 weeks ago

I have a related issue. I use dexed with both a regular keyboard and an MPE synth, and when I use the regular keyboard MPE turns off. This is convenient, but then when I go back to MPE it doesn't turn back on. Ideally it would be able to detect both directions.

Alternatively there could be an option to disable auto detection, although in that case I'd need to have a way to bind the MPE toggle to a MIDI message so I could turn it off and on in my headless setup.