Another engine dialog edge-case fix to set the samplerate
authorRobin Gareus <robin@gareus.org>
Sun, 11 Nov 2018 18:51:56 +0000 (19:51 +0100)
committerRobin Gareus <robin@gareus.org>
Sun, 11 Nov 2018 18:51:56 +0000 (19:51 +0100)
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

index f82f45bce7cbd8308c95035ea8ef83e2b0f1ffb7..69dc179798b71c515494640b1353cdf4d8609365 100644 (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 ();
 }