diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2019-11-06 17:35:30 -0700 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2019-11-06 17:35:30 -0700 |
commit | eda27cc3de7dda78aaf24edf0ba7e75e7a9df8b9 (patch) | |
tree | 5dc792543dbe1c9bcdf6e89872fba63b14a5635c | |
parent | 88c4158c032e5f7700ad57872ca7a69793ff0c4f (diff) |
move all responsibility for autostart into StartupFSM and out of engine dialog
-rw-r--r-- | gtk2_ardour/engine_dialog.cc | 12 | ||||
-rw-r--r-- | gtk2_ardour/engine_dialog.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/startup_fsm.cc | 32 |
3 files changed, 23 insertions, 22 deletions
diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index 182a931cef..6cbe040371 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -471,18 +471,6 @@ EngineControl::config_parameter_changed (std::string const & p) } bool -EngineControl::try_autostart () -{ - if (!start_stop_button.get_sensitive()) { - return false; - } - if (ARDOUR::AudioEngine::instance()->running()) { - return true; - } - return start_engine (); -} - -bool EngineControl::start_engine () { if (push_state_to_backend (true) != 0) { diff --git a/gtk2_ardour/engine_dialog.h b/gtk2_ardour/engine_dialog.h index 7592d4e9a8..5d3d6854d9 100644 --- a/gtk2_ardour/engine_dialog.h +++ b/gtk2_ardour/engine_dialog.h @@ -55,7 +55,6 @@ public: bool set_state (const XMLNode&); void set_desired_sample_rate (uint32_t); - bool try_autostart (); private: Gtk::Notebook notebook; diff --git a/gtk2_ardour/startup_fsm.cc b/gtk2_ardour/startup_fsm.cc index 599eb0e337..7d05ca051a 100644 --- a/gtk2_ardour/startup_fsm.cc +++ b/gtk2_ardour/startup_fsm.cc @@ -425,21 +425,35 @@ StartupFSM::start_audio_midi_setup () } if (setup_required) { - if (!session_is_new && session_existing_sample_rate > 0) { - audiomidi_dialog.set_desired_sample_rate (session_existing_sample_rate); - } - if (!session_is_new && (Config->get_try_autostart_engine () || g_getenv ("ARDOUR_TRY_AUTOSTART_ENGINE"))) { + /* Note: if autostart is enabled, and starting the engine is + * successful, but the session SR differs, there will be no + * chance to reset it. + * + * We could change this trivially with a call to + * AudioEngine::set_sample_rate(), but that opens a can of + * worms about policy, UX, GUI and more, because it isn't clear + * whether that's the correct thing to do. So for now (Nov + * 2019) we simply try the autostart if the user asked for it, + * and if necessary a session SR mismatch dialog will appear + * during loading. + */ - audiomidi_dialog.try_autostart (); + if (!session_is_new && (Config->get_try_autostart_engine () || g_getenv ("ARDOUR_TRY_AUTOSTART_ENGINE"))) { - if (ARDOUR::AudioEngine::instance()->running()) { - DEBUG_TRACE (DEBUG::GuiStartup, "autostart successful, audio/MIDI setup dialog not required\n"); - engine_running (); - return; + if (!AudioEngine::instance()->start ()) { + if (ARDOUR::AudioEngine::instance()->running()) { + DEBUG_TRACE (DEBUG::GuiStartup, "autostart successful, audio/MIDI setup dialog not required\n"); + engine_running (); + return; + } } } + if (!session_is_new && session_existing_sample_rate > 0) { + audiomidi_dialog.set_desired_sample_rate (session_existing_sample_rate); + } + show_audiomidi_dialog (); DEBUG_TRACE (DEBUG::GuiStartup, "audiomidi shown and waiting\n"); |