diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 4998d4b771..8b8a7cdef2 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -1141,7 +1141,8 @@ ARDOUR_UI::every_second () void ARDOUR_UI::every_point_one_seconds () { - shuttle_box->update_speed_display (); + // TODO get rid of this.. + // ShuttleControl is updated directly via TransportStateChange signal } void diff --git a/gtk2_ardour/shuttle_control.cc b/gtk2_ardour/shuttle_control.cc index 654785d435..2efda697a1 100644 --- a/gtk2_ardour/shuttle_control.cc +++ b/gtk2_ardour/shuttle_control.cc @@ -132,6 +132,15 @@ ShuttleControl::map_transport_state () { float speed = _session->transport_speed (); + if ( (fabsf( speed - last_speed_displayed) < 0.005f) // dead-zone + && !( speed == 1.f && last_speed_displayed != 1.f) + && !( speed == 0.f && last_speed_displayed != 0.f) + ) + { + return; // nothing to see here, move along. + } + + // Q: is there a good reason why we re-calculate this every time? if (fabs(speed) <= (2*DBL_EPSILON)) { shuttle_fract = 0; } else { @@ -232,6 +241,7 @@ void ShuttleControl::set_shuttle_max_speed (float speed) { shuttle_max_speed = speed; + last_speed_displayed = -99999999; } bool @@ -637,19 +647,6 @@ ShuttleControl::set_shuttle_units (ShuttleUnits s) Config->set_shuttle_units (s); } -void -ShuttleControl::update_speed_display () -{ - const float speed = _session->transport_speed(); - if ( (fabsf( speed - last_speed_displayed) > 0.009f) // dead-zone just below 1%, except.. - || ( speed == 1.f && last_speed_displayed != 1.f) - || ( speed == 0.f && last_speed_displayed != 0.f) - ) - { - queue_draw (); - } -} - ShuttleControl::ShuttleControllable::ShuttleControllable (ShuttleControl& s) : PBD::Controllable (X_("Shuttle")) , sc (s) diff --git a/gtk2_ardour/shuttle_control.h b/gtk2_ardour/shuttle_control.h index 0b289c5180..21b02d9954 100644 --- a/gtk2_ardour/shuttle_control.h +++ b/gtk2_ardour/shuttle_control.h @@ -39,8 +39,7 @@ class ShuttleControl : public CairoWidget, public ARDOUR::SessionHandlePtr ~ShuttleControl (); void map_transport_state (); - void update_speed_display (); - void set_shuttle_fract (double, bool zero_ok = false); + void set_shuttle_fract (double, bool zero_ok = false); double get_shuttle_fract () const { return shuttle_fract; } void set_session (ARDOUR::Session*);