From e6febe040af3c305a71b0ffdc10e9f9cd9a98e6b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 9 Apr 2020 23:31:15 +0200 Subject: [PATCH] Continue to load session after latency calibration #7998 --- gtk2_ardour/engine_dialog.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index c6ba4f42cb..a45c97aa05 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -2869,6 +2869,8 @@ EngineControl::set_desired_sample_rate (uint32_t sr) void EngineControl::on_switch_page (GtkNotebookPage*, guint page_num) { + bool was_calibrating_midi = _measure_midi != 0; + if (page_num == 0) { _measure_midi.reset(); update_sensitivity (); @@ -2935,6 +2937,17 @@ EngineControl::on_switch_page (GtkNotebookPage*, guint page_num) end_latency_detection (); } } + + /* after latency calibration the engine is running, continue to load session. + * RESPONSE_OK is a NO-OP when the dialog is displayed as Window + * from a running instance. + */ + if (page_num == 0 && _have_control && was_calibrating_midi && ARDOUR::AudioEngine::instance()->running()) { + boost::shared_ptr backend = ARDOUR::AudioEngine::instance()->current_backend(); + if (backend && backend->can_change_systemic_latency_when_running ()) { + response (RESPONSE_OK); + } + } } /* latency measurement */ @@ -3166,6 +3179,14 @@ EngineControl::use_latency_button_clicked () if (backend->can_change_systemic_latency_when_running ()) { backend->set_systemic_input_latency (one_way); backend->set_systemic_output_latency (one_way); + + /* engine is running, continue to load session. + * RESPONSE_OK is a NO-OP when the dialog is displayed as Window + * from a running instance. + */ + notebook.set_current_page (0); + response (RESPONSE_OK); + return; } /* back to settings page */