From 9398a6f60a556dbac0bf85f2b50b4773674b66ef Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 6 Jun 2020 17:10:31 +0200 Subject: [PATCH] Fix generic MIDI encoder off by one Increment for CC values > 0x40, decrement control for values <= 40. - 0x41 increment by one - 0x40 decrement by one previously: 0x3f decremented by one, 0x3e by two, .. 0x00 by 64, but 0x40 also by 64. --- libs/surfaces/generic_midi/midicontrollable.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/surfaces/generic_midi/midicontrollable.cc b/libs/surfaces/generic_midi/midicontrollable.cc index 5a75afc89a..42e4db6e0d 100644 --- a/libs/surfaces/generic_midi/midicontrollable.cc +++ b/libs/surfaces/generic_midi/midicontrollable.cc @@ -382,7 +382,7 @@ MIDIControllable::midi_sense_controller (Parser &, EventTwoBytes *msg) if (msg->value > 0x40) { _controllable->set_value (midi_to_control (last_value + offset + 1), Controllable::UseGroup); } else { - _controllable->set_value (midi_to_control (last_value - (0x40 - offset)), Controllable::UseGroup); + _controllable->set_value (midi_to_control (last_value - (0x41 - msg->value)), Controllable::UseGroup); } break; default: