X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Ftranzport%2Fwheel.cc;h=d90e0e2b6edd1214f3087c00d490a67fe74d69c3;hb=22b07e0233a29d9633ffa825a79503befaf2e16e;hp=3f15e060a2d64ee8ba1443bd07b5192d7c6cb040;hpb=8c9749e42faf7808034ed8b7afce4a2fe6dc6f33;p=ardour.git diff --git a/libs/surfaces/tranzport/wheel.cc b/libs/surfaces/tranzport/wheel.cc index 3f15e060a2..d90e0e2b6e 100644 --- a/libs/surfaces/tranzport/wheel.cc +++ b/libs/surfaces/tranzport/wheel.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Paul Davis + * Copyright (C) 2006 Paul Davis * Copyright (C) 2007 Michael Taht * * This program is free software; you can redistribute it and/or modify @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * + * * */ #include @@ -55,7 +55,7 @@ TranzportControlProtocol::datawheel () if ((buttonmask & ButtonTrackRight) || (buttonmask & ButtonTrackLeft)) { /* track scrolling */ - + if (_datawheel < WheelDirectionThreshold) { next_track (); } else { @@ -63,7 +63,7 @@ TranzportControlProtocol::datawheel () } last_wheel_motion = 0; - + } else if ((buttonmask & ButtonPrev) || (buttonmask & ButtonNext)) { if (_datawheel < WheelDirectionThreshold) { @@ -71,13 +71,13 @@ TranzportControlProtocol::datawheel () } else { prev_marker (); } - + last_wheel_motion = 0; - + } else if (buttonmask & ButtonShift) { - + /* parameter control */ - + if (route_table[0]) { switch (wheel_shift_mode) { case WheelShiftGain: @@ -94,29 +94,29 @@ TranzportControlProtocol::datawheel () step_pan_left (); } break; - + case WheelShiftMarker: break; - + case WheelShiftMaster: break; - + } } - + last_wheel_motion = 0; - + } else { - + switch (wheel_mode) { case WheelTimeline: scroll (); break; - + case WheelScrub: scrub (); break; - + case WheelShuttle: shuttle (); break; @@ -151,35 +151,35 @@ TranzportControlProtocol::scrub () float speed; uint64_t now; int dir; - + now = g_get_monotonic_time(); - + if (_datawheel < WheelDirectionThreshold) { dir = 1; } else { dir = -1; } - + if (dir != last_wheel_dir) { /* changed direction, start over */ speed = 0.1f; } else { if (last_wheel_motion != 0) { /* 10 clicks per second => speed == 1.0 */ - + speed = 100000.0f / (float) (now - last_wheel_motion) - + } else { - + /* start at half-speed and see where we go from there */ - + speed = 0.5f; } } - + last_wheel_motion = now; last_wheel_dir = dir; - + set_transport_speed (speed * dir); }