diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc index 2a353d4b7d..02686b62ff 100644 --- a/gtk2_ardour/tempo_dialog.cc +++ b/gtk2_ardour/tempo_dialog.cc @@ -261,18 +261,17 @@ TempoDialog::pulse_change () set_response_sensitive (RESPONSE_ACCEPT, is_user_input_valid()); } - bool TempoDialog::tap_tempo_button_press (GdkEventButton *ev) { - guint32 now; - now = ev->time; // milliseconds + gint64 now; + now = g_get_monotonic_time (); // microseconds if (tapped) { double interval, bpm; static const double decay = 0.5; - interval = (now - last_tap) * 1.0e-3; + interval = (now - last_tap) * 1.0e-6; if (interval <= 6.0) { // <= 6 seconds (say): >= 10 bpm if (average_interval > 0 && average_interval > interval / 1.2 && average_interval < interval * 1.2) { @@ -292,7 +291,6 @@ TempoDialog::tap_tempo_button_press (GdkEventButton *ev) tapped = true; } last_tap = now; - return false; } bool diff --git a/gtk2_ardour/tempo_dialog.h b/gtk2_ardour/tempo_dialog.h index 97d89e2867..eda4e61f1a 100644 --- a/gtk2_ardour/tempo_dialog.h +++ b/gtk2_ardour/tempo_dialog.h @@ -60,8 +60,8 @@ private: NoteTypes note_types; bool tapped; // whether the tap-tempo button has been clicked - guint32 last_tap; // time of the last tap (in mS, from GdkEventButton::time). Only valid if tapped is true - double average_interval; // running average of tap tempo button press interval times + gint64 last_tap; + double average_interval; Gtk::ComboBoxText pulse_selector; Gtk::Adjustment bpm_adjustment;