From 2991d74da53edc5a3b09d1cfdf7703212fda5d99 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 7 Apr 2020 00:11:19 +0200 Subject: GUI: follow LatencyUpdated signal handler, prevent duplicate updates --- gtk2_ardour/ardour_ui.h | 2 +- gtk2_ardour/ardour_ui2.cc | 12 ++++++++++-- gtk2_ardour/ardour_ui_dialogs.cc | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 8ef3071e4f..346bdc4a65 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -837,7 +837,7 @@ private: void toggle_latency_switch (); void latency_switch_changed (); - void session_latency_updated (); + void session_latency_updated (bool); void feedback_detected (); diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 575925153c..d180fbadbe 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -604,7 +604,7 @@ ARDOUR_UI::setup_transport () /* initialize */ latency_switch_changed (); - session_latency_updated (); + session_latency_updated (true); repack_transport_hbox (); update_clock_visibility (); @@ -631,8 +631,16 @@ ARDOUR_UI::latency_switch_changed () } void -ARDOUR_UI::session_latency_updated () +ARDOUR_UI::session_latency_updated (bool for_playback) { + if (!for_playback) { + /* latency updates happen in pairs, in the following order: + * - for capture + * - for playback + */ + return; + } + if (!_session) { route_latency_value.set_text ("--"); io_latency_value.set_text ("--"); diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index c602c16dd4..2ca699df45 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -204,8 +204,8 @@ ARDOUR_UI::set_session (Session *s) _session->locations()->removed.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::handle_locations_change, this, _1), gui_context()); _session->config.ParameterChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::session_parameter_changed, this, _1), gui_context ()); - _session->LatencyUpdated.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::session_latency_updated, this), gui_context()); - session_latency_updated (); + _session->LatencyUpdated.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::session_latency_updated, this, _1), gui_context()); + session_latency_updated (true); /* Clocks are on by default after we are connected to a session, so show that here. */ -- cgit v1.2.3