From 8f216afa245da108d1617dedb2a0a5197250eb18 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 11 Nov 2018 19:51:56 +0100 Subject: [PATCH] Another engine dialog edge-case fix to set the samplerate Honor the sesssion's sample-rate when showing the dialog with the engine stopped. This can happen when then engine dies or hide/show the dialog after manually stopping the engine. --- gtk2_ardour/engine_dialog.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index f82f45bce7..69dc179798 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -1364,8 +1364,15 @@ EngineControl::set_samplerate_popdown_strings () if (!s.empty()) { if (ARDOUR::AudioEngine::instance()->running()) { sample_rate_combo.set_active_text (rate_as_string (backend->sample_rate())); - } - else if (desired.empty ()) { + } else if (ARDOUR_UI::instance()->session_loaded) { + float active_sr = ARDOUR_UI::instance()->the_session()->nominal_sample_rate (); + + if (std::find (sr.begin (), sr.end (), active_sr) == sr.end ()) { + active_sr = sr.front (); + } + + sample_rate_combo.set_active_text (rate_as_string (active_sr)); + } else if (desired.empty ()) { float new_active_sr = backend->default_sample_rate (); if (std::find (sr.begin (), sr.end (), new_active_sr) == sr.end ()) { @@ -1376,7 +1383,6 @@ EngineControl::set_samplerate_popdown_strings () } else { sample_rate_combo.set_active_text (desired); } - } update_sensitivity (); }