skip LV2 ports on GUI according to port-properties: notOnGUI and reportsLatency
[ardour.git] / gtk2_ardour / shuttle_control.cc
index b4095f7c0c9e84a5fa9b467bba7dd4a159226bcb..a4a83d7018fe2b443f49483865c5c08a617fb5f8 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <algorithm>
 
-#include <cairo/cairo.h>
+#include <cairo.h>
 
 #include "ardour/ardour.h"
 #include "ardour/audioengine.h"
@@ -31,6 +31,7 @@
 #include "gtkmm2ext/utils.h"
 #include "gtkmm2ext/rgb_macros.h"
 
+#include "actions.h"
 #include "ardour_ui.h"
 #include "rgb_macros.h"
 #include "shuttle_control.h"
@@ -427,10 +428,10 @@ ShuttleControl::mouse_shuttle (double x, bool force)
 }
 
 void
-ShuttleControl::set_shuttle_fract (double f)
+ShuttleControl::set_shuttle_fract (double f, bool zero_ok)
 {
        shuttle_fract = f;
-       use_shuttle_fract (false);
+       use_shuttle_fract (false, zero_ok);
 }
 
 int
@@ -472,7 +473,7 @@ ShuttleControl::fract_as_semitones (float fract, bool& reverse)
 }
 
 void
-ShuttleControl::use_shuttle_fract (bool force)
+ShuttleControl::use_shuttle_fract (bool force, bool zero_ok)
 {
        microseconds_t now = get_microseconds();
 
@@ -503,7 +504,11 @@ ShuttleControl::use_shuttle_fract (bool force)
                speed = shuttle_max_speed * shuttle_fract;
        }
 
-       _session->request_transport_speed_nonzero (speed, Config->get_shuttle_behaviour() == Wheel);
+       if (zero_ok) {
+               _session->request_transport_speed (speed, Config->get_shuttle_behaviour() == Wheel);
+       } else {
+               _session->request_transport_speed_nonzero (speed, Config->get_shuttle_behaviour() == Wheel);
+       }
 }
 
 void
@@ -657,25 +662,13 @@ ShuttleControl::ShuttleControllable::ShuttleControllable (ShuttleControl& s)
 void
 ShuttleControl::ShuttleControllable::set_value (double val)
 {
-       double fract;
-
-       if (val == 0.5) {
-               fract = 0.0;
-       } else {
-               if (val < 0.5) {
-                       fract = -((0.5 - val)/0.5);
-               } else {
-                       fract = ((val - 0.5)/0.5);
-               }
-       }
-
-       sc.set_shuttle_fract (fract);
+       sc.set_shuttle_fract ((val - lower()) / (upper() - lower()), true);
 }
 
 double
 ShuttleControl::ShuttleControllable::get_value () const
 {
-       return sc.get_shuttle_fract ();
+       return lower() + (sc.get_shuttle_fract () * (upper() - lower()));
 }
 
 void