X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fshuttle_control.cc;h=1d150f73d67511ff8a60ab838e0820a3376e601c;hb=e1b0f1bd0b03c071d2b5987e4ab75ef059e32111;hp=aaa22f50897763b31d4ed16f2044d090d84b6af3;hpb=19be6f4886207edc459b6d0a496e0aa599bf2391;p=ardour.git diff --git a/gtk2_ardour/shuttle_control.cc b/gtk2_ardour/shuttle_control.cc index aaa22f5089..1d150f73d6 100644 --- a/gtk2_ardour/shuttle_control.cc +++ b/gtk2_ardour/shuttle_control.cc @@ -18,7 +18,7 @@ #include -#include +#include #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" @@ -112,7 +113,7 @@ ShuttleControl::on_size_allocate (Gtk::Allocation& alloc) //background pattern = cairo_pattern_create_linear (0, 0, 0, alloc.get_height()); - uint32_t col = ARDOUR_UI::config()->canvasvar_Shuttle.get(); + uint32_t col = ARDOUR_UI::config()->get_canvasvar_Shuttle(); int r,b,g,a; UINT_TO_RGBA(col, &r, &g, &b, &a); cairo_pattern_add_color_stop_rgb (pattern, 0.0, r/400.0, g/400.0, b/400.0); @@ -290,6 +291,9 @@ ShuttleControl::on_button_release_event (GdkEventButton* ev) gdk_pointer_ungrab (GDK_CURRENT_TIME); if (Config->get_shuttle_behaviour() == Sprung) { + if (shuttle_speed_on_grab == 0 ) { + _session->request_transport_speed (1.0); + } _session->request_transport_speed (shuttle_speed_on_grab); } else { mouse_shuttle (ev->x, true); @@ -424,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 @@ -469,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(); @@ -500,7 +504,11 @@ ShuttleControl::use_shuttle_fract (bool force) speed = shuttle_max_speed * shuttle_fract; } - _session->request_transport_speed_nonzero (speed, true); + 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 @@ -654,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