diff options
author | Robin Gareus <robin@gareus.org> | 2014-05-16 19:58:46 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2014-05-16 19:58:46 +0200 |
commit | f3349a797c98cb86f5106addf431543968241bc3 (patch) | |
tree | 6f19775c4b0e3e3bd3cf50db8c3ee75e8843c890 /libs/surfaces | |
parent | 5fba8a2015706becc7e684fa7228de3e95f03515 (diff) |
more gettimeofday() -> g_get_monotonic_time()
Diffstat (limited to 'libs/surfaces')
-rw-r--r-- | libs/surfaces/frontier/tranzport/tranzport_control_protocol.h | 2 | ||||
-rw-r--r-- | libs/surfaces/tranzport/wheel.cc | 18 |
2 files changed, 8 insertions, 12 deletions
diff --git a/libs/surfaces/frontier/tranzport/tranzport_control_protocol.h b/libs/surfaces/frontier/tranzport/tranzport_control_protocol.h index da7340182e..63e6ad4201 100644 --- a/libs/surfaces/frontier/tranzport/tranzport_control_protocol.h +++ b/libs/surfaces/frontier/tranzport/tranzport_control_protocol.h @@ -154,7 +154,7 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol framepos_t last_where; ARDOUR::gain_t last_track_gain; uint32_t last_meter_fill; - struct timeval last_wheel_motion; + uint64_t last_wheel_motion; int last_wheel_dir; Glib::Mutex io_lock; diff --git a/libs/surfaces/tranzport/wheel.cc b/libs/surfaces/tranzport/wheel.cc index baa4ba079b..3f15e060a2 100644 --- a/libs/surfaces/tranzport/wheel.cc +++ b/libs/surfaces/tranzport/wheel.cc @@ -62,7 +62,7 @@ TranzportControlProtocol::datawheel () prev_track (); } - timerclear (&last_wheel_motion); + last_wheel_motion = 0; } else if ((buttonmask & ButtonPrev) || (buttonmask & ButtonNext)) { @@ -72,7 +72,7 @@ TranzportControlProtocol::datawheel () prev_marker (); } - timerclear (&last_wheel_motion); + last_wheel_motion = 0; } else if (buttonmask & ButtonShift) { @@ -104,7 +104,7 @@ TranzportControlProtocol::datawheel () } } - timerclear (&last_wheel_motion); + last_wheel_motion = 0; } else { @@ -149,11 +149,10 @@ void TranzportControlProtocol::scrub () { float speed; - struct timeval now; - struct timeval delta; + uint64_t now; int dir; - gettimeofday (&now, 0); + now = g_get_monotonic_time(); if (_datawheel < WheelDirectionThreshold) { dir = 1; @@ -165,13 +164,10 @@ TranzportControlProtocol::scrub () /* changed direction, start over */ speed = 0.1f; } else { - if (timerisset (&last_wheel_motion)) { - - timersub (&now, &last_wheel_motion, &delta); - + if (last_wheel_motion != 0) { /* 10 clicks per second => speed == 1.0 */ - speed = 100000.0f / (delta.tv_sec * 1000000 + delta.tv_usec); + speed = 100000.0f / (float) (now - last_wheel_motion) } else { |