diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-12-19 01:28:41 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-12-19 01:28:41 +0000 |
commit | 37906d067e44927e6ad575ff8a757a8837fbb4cf (patch) | |
tree | 6415024091cc7a516c4c921f9c4fb9372feef46f /libs | |
parent | 99c848455aca397335c3d57e85c3f7c82f5b0a9d (diff) |
feedback for toggled MIDI controls now sends 0 or 127, not various in-between values (should fix #5117, without any bad side-effects
git-svn-id: svn://localhost/ardour2/branches/3.0@13680 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/surfaces/generic_midi/midicontrollable.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libs/surfaces/generic_midi/midicontrollable.cc b/libs/surfaces/generic_midi/midicontrollable.cc index 96d2c1772c..71021e9c84 100644 --- a/libs/surfaces/generic_midi/midicontrollable.cc +++ b/libs/surfaces/generic_midi/midicontrollable.cc @@ -163,6 +163,14 @@ MIDIControllable::control_to_midi (float val) float control_max = controllable->upper (); const float control_range = control_max - control_min; + if (controllable->is_toggle()) { + if (val >= (control_min + (control_range/2.0f))) { + return max_value_for_type(); + } else { + return 0; + } + } + return (val - control_min) / control_range * max_value_for_type (); } |