summaryrefslogtreecommitdiff
path: root/libs/surfaces/generic_midi
diff options
context:
space:
mode:
authorLen Ovens <len@ovenwerks.net>2015-12-13 15:53:24 -0800
committerLen Ovens <len@ovenwerks.net>2015-12-13 15:53:24 -0800
commit634321ba455139c7d993857b417745d247c0ce4b (patch)
tree94e332f0b21c4e313ee9de7f34c6693c88c2c987 /libs/surfaces/generic_midi
parent756a4cd85f792a91423bf474902d52c09e0c6c90 (diff)
Fix Trim control range does not match control (issue #6696)
Diffstat (limited to 'libs/surfaces/generic_midi')
-rw-r--r--libs/surfaces/generic_midi/midicontrollable.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/libs/surfaces/generic_midi/midicontrollable.cc b/libs/surfaces/generic_midi/midicontrollable.cc
index 29271418a7..f4025b591f 100644
--- a/libs/surfaces/generic_midi/midicontrollable.cc
+++ b/libs/surfaces/generic_midi/midicontrollable.cc
@@ -204,20 +204,22 @@ MIDIControllable::control_to_midi (float val)
float
MIDIControllable::midi_to_control (int val)
{
- /* fiddle with MIDI value so that we get an odd number of integer steps
- and can thus represent "middle" precisely as 0.5. this maps to
- the range 0..+1.0 (0 to 126)
- */
+ /* fiddle with MIDI value so that we get an odd number of integer steps
+ and can thus represent "middle" precisely as 0.5. this maps to
+ the range 0..+1.0 (0 to 126)
+ */
- float fv = (val == 0 ? 0 : float (val - 1) / (max_value_for_type() - 1));
+ float fv = (val == 0 ? 0 : float (val - 1) / (max_value_for_type() - 1));
- if (controllable->is_gain_like()) {
- return slider_position_to_gain (fv);
- }
+ if (controllable->is_gain_like()) {
+ return controllable->interface_to_internal (fv);
+ }
+ DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("Raw value %1 float %2\n", val, fv));
float control_min = controllable->lower ();
float control_max = controllable->upper ();
float control_range = control_max - control_min;
+ DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("Min %1 Max %2 Range %3\n", control_min, control_max, control_range));
AutomationControl *actl = dynamic_cast<AutomationControl*> (controllable);
if (actl) {