summaryrefslogtreecommitdiff
path: root/libs/surfaces
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-06-02 11:32:13 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2014-06-02 11:32:13 -0400
commit8c9749e42faf7808034ed8b7afce4a2fe6dc6f33 (patch)
tree823af8a96f4e0b2a404f5e52eadf4f46e1d10229 /libs/surfaces
parentf6d29abfc75c460b9e35717f2907e4e61bf38058 (diff)
parent08a1409b1f5b5558d2eccc28a3ae4cbd44391812 (diff)
merge with master and fix 4 conflicts by hand
Diffstat (limited to 'libs/surfaces')
-rw-r--r--libs/surfaces/generic_midi/midicontrollable.cc23
1 files changed, 20 insertions, 3 deletions
diff --git a/libs/surfaces/generic_midi/midicontrollable.cc b/libs/surfaces/generic_midi/midicontrollable.cc
index a26617fd67..1d96a073b0 100644
--- a/libs/surfaces/generic_midi/midicontrollable.cc
+++ b/libs/surfaces/generic_midi/midicontrollable.cc
@@ -169,7 +169,7 @@ MIDIControllable::control_to_midi (float val)
float control_min = controllable->lower ();
float control_max = controllable->upper ();
- const float control_range = control_max - control_min;
+ float control_range = control_max - control_min;
if (controllable->is_toggle()) {
if (val >= (control_min + (control_range/2.0f))) {
@@ -177,6 +177,14 @@ MIDIControllable::control_to_midi (float val)
} else {
return 0;
}
+ } else {
+ AutomationControl *actl = dynamic_cast<AutomationControl*> (controllable);
+ if (actl) {
+ control_min = actl->internal_to_interface(control_min);
+ control_max = actl->internal_to_interface(control_max);
+ control_range = control_max - control_min;
+ val = actl->internal_to_interface(val);
+ }
}
return (val - control_min) / control_range * max_value_for_type ();
@@ -198,8 +206,17 @@ MIDIControllable::midi_to_control (int val)
float control_min = controllable->lower ();
float control_max = controllable->upper ();
- const float control_range = control_max - control_min;
-
+ float control_range = control_max - control_min;
+
+ AutomationControl *actl = dynamic_cast<AutomationControl*> (controllable);
+ if (actl) {
+ if (fv == 0.f) return control_min;
+ if (fv == 1.f) return control_max;
+ control_min = actl->internal_to_interface(control_min);
+ control_max = actl->internal_to_interface(control_max);
+ control_range = control_max - control_min;
+ return actl->interface_to_internal((fv * control_range) + control_min);
+ }
return (fv * control_range) + control_min;
}