From ae3d4efce0a39bb7f603a8b1e990cfdd36e34a59 Mon Sep 17 00:00:00 2001 From: Len Ovens Date: Mon, 20 Jul 2015 13:34:11 -0700 Subject: [PATCH] Make program change toggle or 1 only. --- libs/surfaces/generic_midi/midicontrollable.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/libs/surfaces/generic_midi/midicontrollable.cc b/libs/surfaces/generic_midi/midicontrollable.cc index 81f2a5141d..a5c2e9c017 100644 --- a/libs/surfaces/generic_midi/midicontrollable.cc +++ b/libs/surfaces/generic_midi/midicontrollable.cc @@ -347,14 +347,16 @@ MIDIControllable::midi_sense_program_change (Parser &, MIDI::byte msg) return; } } + if (msg == control_additional) { - if (!controllable->is_toggle()) { - controllable->set_value (midi_to_control (msg)); - DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("MIDI program %1 value %2 %3\n", (int) msg, (float) midi_to_control (msg), current_uri() )); - } else if (msg == control_additional) { - float new_value = controllable->get_value() > 0.5f ? 0.0f : 1.0f; - controllable->set_value (new_value); - DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("MIDI program %1 value %2 %3\n", (int) msg, (float) new_value, current_uri())); + if (!controllable->is_toggle()) { + controllable->set_value (1.0); + DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("MIDI program %1 value 1.0 %3\n", (int) msg, current_uri() )); + } else { + float new_value = controllable->get_value() > 0.5f ? 0.0f : 1.0f; + controllable->set_value (new_value); + DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("MIDI program %1 value %2 %3\n", (int) msg, (float) new_value, current_uri())); + } } last_value = (MIDI::byte) (controllable->get_value() * 127.0); // to prevent feedback fights