+ if (new_session_dialog->create_master_bus()) {
+ mchns = (uint32_t) new_session_dialog->master_channel_count();
+ } else {
+ mchns = 0;
+ }
+
+ if (new_session_dialog->connect_inputs()) {
+ iconnect = AutoConnectPhysical;
+ } else {
+ iconnect = AutoConnectOption (0);
+ }
+
+ /// @todo some minor tweaks.
+
+ if (new_session_dialog->connect_outs_to_master()) {
+ oconnect = AutoConnectMaster;
+ } else if (new_session_dialog->connect_outs_to_physical()) {
+ oconnect = AutoConnectPhysical;
+ } else {
+ oconnect = AutoConnectOption (0);
+ }
+
+ nphysin = (uint32_t) new_session_dialog->input_limit_count();
+ nphysout = (uint32_t) new_session_dialog->output_limit_count();
+ }
+
+ if (build_session (session_path,
+ session_name,
+ cchns,
+ mchns,
+ iconnect,
+ oconnect,
+ nphysin,
+ nphysout,
+ engine->frame_rate() * 60 * 5)) {
+
+ return -1;
+ }
+
+ return 0;
+}
+
+void
+ARDOUR_UI::end_loading_messages ()
+{
+ // hide_splash ();
+}
+
+void
+ARDOUR_UI::loading_message (const std::string& msg)
+{
+ show_splash ();
+ splash->message (msg);
+ flush_pending ();
+}
+
+void
+ARDOUR_UI::idle_load (const Glib::ustring& path)
+{
+ if (session) {
+ if (Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) {
+ /* /path/to/foo => /path/to/foo, foo */
+ load_session (path, basename_nosuffix (path));
+ } else {
+ /* /path/to/foo/foo.ardour => /path/to/foo, foo */
+ load_session (Glib::path_get_dirname (path), basename_nosuffix (path));
+ }
+ } else {
+
+ ARDOUR_COMMAND_LINE::session_name = path;
+
+ if (new_session_dialog) {
+
+
+ /* make it break out of Dialog::run() and
+ start again.
+ */
+
+ new_session_dialog->response (1);
+ }
+ }
+}
+
+/** @param offer_quit true to offer a Cancel button, otherwise call it Quit */
+bool
+ARDOUR_UI::get_session_parameters (bool backend_audio_is_running, bool should_be_new, bool offer_cancel)
+{
+ bool existing_session = false;
+ Glib::ustring session_name;
+ Glib::ustring session_path;
+ Glib::ustring template_name;
+ int response;
+
+ begin:
+ response = Gtk::RESPONSE_NONE;
+
+ if (!ARDOUR_COMMAND_LINE::session_name.empty()) {
+
+ parse_cmdline_path (ARDOUR_COMMAND_LINE::session_name, session_name, session_path, existing_session);
+
+ /* don't ever reuse this */
+
+ ARDOUR_COMMAND_LINE::session_name = string();
+
+ if (existing_session && backend_audio_is_running) {
+
+ /* just load the thing already */
+
+ if (load_cmdline_session (session_name, session_path, existing_session) == 0) {
+ return true;
+ }
+ }
+
+ /* make the NSD use whatever information we have */
+
+ new_session_dialog->set_session_name (session_name);
+ new_session_dialog->set_session_folder (session_path);
+ }
+
+ /* loading failed, or we need the NSD for something */
+
+ new_session_dialog->set_modal (false);
+ new_session_dialog->set_position (WIN_POS_CENTER);
+ new_session_dialog->set_current_page (0);
+ new_session_dialog->set_existing_session (existing_session);
+ new_session_dialog->reset_recent();
+ new_session_dialog->set_offer_cancel (offer_cancel);
+
+ do {
+ new_session_dialog->set_have_engine (backend_audio_is_running);
+ new_session_dialog->present ();
+ end_loading_messages ();
+ response = new_session_dialog->run ();
+