diff options
author | Len Ovens <len@ovenwerks.net> | 2015-07-20 13:34:11 -0700 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-07-27 16:17:38 -0400 |
commit | ae3d4efce0a39bb7f603a8b1e990cfdd36e34a59 (patch) | |
tree | 455ff1e6cd9a600b387686bdd0cb87b6fa722967 | |
parent | 6ab04a27c314c75d0ff84357c01f98f2f285f12a (diff) |
Make program change toggle or 1 only.
-rw-r--r-- | libs/surfaces/generic_midi/midicontrollable.cc | 16 |
1 files 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 |