From 1b91615b2c366c8bc0db6f689084a5f2a86bbe05 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 12 Dec 2019 13:32:42 -0700 Subject: [PATCH] fix startup FSM handling when pre-release dialog is shown AND cmdline session info is given --- gtk2_ardour/startup_fsm.cc | 66 +++++++++++++++++++++----------------- gtk2_ardour/startup_fsm.h | 1 + 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/gtk2_ardour/startup_fsm.cc b/gtk2_ardour/startup_fsm.cc index e901e9311a..5183673147 100644 --- a/gtk2_ardour/startup_fsm.cc +++ b/gtk2_ardour/startup_fsm.cc @@ -141,35 +141,7 @@ StartupFSM::start () show_new_user_dialog (); break; case WaitingForSessionPath: - if (ARDOUR_COMMAND_LINE::session_name.empty()) { - - /* nothing given on the command line ... show new session dialog */ - - show_session_dialog (new_session_required); - - } else { - - if (get_session_parameters_from_command_line (new_session_required)) { - - /* command line arguments all OK. Get engine parameters */ - - if (!new_session_required && session_existing_sample_rate > 0) { - audiomidi_dialog.set_desired_sample_rate (session_existing_sample_rate); - } - - start_audio_midi_setup (); - - } else { - - /* command line arguments not good. Use - * dialog, but prime the dialog with - * the information we set up in - * get_session_parameters_from_command_line() - */ - - show_session_dialog (new_session_required); - } - } + handle_waiting_for_session_path (); break; default: fatal << string_compose (_("Programming error: %1"), string_compose (X_("impossible starting state in StartupFSM (%1)"), enum_2_string (_state))) << endmsg; @@ -243,7 +215,7 @@ StartupFSM::dialog_response_handler (int response, StartupFSM::DialogID dialog_i if (NewUserWizard::required()) { show_new_user_dialog (); } else { - show_session_dialog (new_session_required); + handle_waiting_for_session_path (); } break; } @@ -344,6 +316,40 @@ StartupFSM::dialog_response_handler (int response, StartupFSM::DialogID dialog_i } } +void +StartupFSM::handle_waiting_for_session_path () +{ + if (ARDOUR_COMMAND_LINE::session_name.empty()) { + + /* nothing given on the command line ... show new session dialog */ + + show_session_dialog (new_session_required); + + } else { + + if (get_session_parameters_from_command_line (new_session_required)) { + + /* command line arguments all OK. Get engine parameters */ + + if (!new_session_required && session_existing_sample_rate > 0) { + audiomidi_dialog.set_desired_sample_rate (session_existing_sample_rate); + } + + start_audio_midi_setup (); + + } else { + + /* command line arguments not good. Use + * dialog, but prime the dialog with + * the information we set up in + * get_session_parameters_from_command_line() + */ + + show_session_dialog (new_session_required); + } + } +} + void StartupFSM::show_plugin_scan_dialog () { diff --git a/gtk2_ardour/startup_fsm.h b/gtk2_ardour/startup_fsm.h index ebdd7cba07..04540f6e66 100644 --- a/gtk2_ardour/startup_fsm.h +++ b/gtk2_ardour/startup_fsm.h @@ -102,6 +102,7 @@ class StartupFSM : public sigc::trackable int check_session_parameters (bool must_be_new); void start_audio_midi_setup (); void engine_running (); + void handle_waiting_for_session_path (); /* the Audio/MIDI dialog needs to be persistent and is thus owned by * ARDOUR_UI and we use it by reference. All other dialogs can be