push2: volume pots now work like non-linear faders, as desired
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 22 Sep 2016 00:25:36 +0000 (19:25 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 27 Sep 2016 19:59:31 +0000 (14:59 -0500)
libs/surfaces/push2/knob.cc
libs/surfaces/push2/mix.cc

index 71edaf5b5c3494325b9feb7c2dae5ba443f38f39..29dffe31bbe7dc294ddbb45fa7738fdd0f11ebc3 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "ardour/automation_control.h"
 #include "ardour/dB.h"
+#include "ardour/utils.h"
 
 #include "gtkmm2ext/gui_thread.h"
 #include "gtkmm2ext/rgb_macros.h"
index 169eec3140eca1a66a1cf22d31524759a1d50fb9..bf08dad8730058f873cc2dd0bcb065935c17474a 100644 (file)
@@ -40,6 +40,7 @@
 #include "ardour/midi_port.h"
 #include "ardour/session.h"
 #include "ardour/tempo.h"
+#include "ardour/utils.h"
 #include "ardour/vca_manager.h"
 
 #include "canvas/colors.h"
@@ -399,7 +400,15 @@ MixLayout::strip_vpot (int n, int delta)
        boost::shared_ptr<Controllable> ac = knobs[n]->controllable();
 
        if (ac) {
-               ac->set_value (ac->get_value() + ((2.0/64.0) * delta), PBD::Controllable::UseGroup);
+               if (ac->is_gain_like()) {
+                       /* 128 steps from fader position 0 to 1.0 ..
+                        */
+                       const double new_fader_position = min (1.0, max (0.0, ac->internal_to_interface (ac->get_value()) + ((1.0 / 128.0) * delta)));
+                       ac->set_value (ac->interface_to_internal (new_fader_position), PBD::Controllable::UseGroup);
+               } else {
+                       /* 128 steps from min to max */
+                       ac->set_value (ac->get_value() + (((ac->upper() - ac->lower()) / 128.0) * delta) , PBD::Controllable::UseGroup);
+               }
        }
 }