summaryrefslogtreecommitdiff
path: root/gtk2_ardour/shuttle_control.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-03-10 10:52:44 +0100
committerRobin Gareus <robin@gareus.org>2015-03-10 10:53:56 +0100
commit2d20bcab4a0a7787f61c15679988c6db47c2ca60 (patch)
tree33fcc27de99983ac1df14f8796fbc578921c2552 /gtk2_ardour/shuttle_control.cc
parent3547540f98658ed5839832aa68e6fe23098cd236 (diff)
dramatically reduce ShuttleControl CPU usage
Diffstat (limited to 'gtk2_ardour/shuttle_control.cc')
-rw-r--r--gtk2_ardour/shuttle_control.cc23
1 files changed, 10 insertions, 13 deletions
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)