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.
This commit is contained in:
Robin Gareus 2018-11-11 19:51:56 +01:00
parent 38301c808c
commit 8f216afa24
1 changed files with 9 additions and 3 deletions

View File

@ -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 ();
}