From 5d0867ec10a3306c860f4b3d8b2af53af9981d83 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 21 May 2020 02:04:24 +0200 Subject: NSM special-cases Special cases to load-or-create session via NSM_Client::command_open This bypasses most of the startup-FSM for NSM. Either a session is loaded or created. JACK is mandatory. --- gtk2_ardour/ardour_ui_startup.cc | 29 +++++++++++++++++++++++++++-- gtk2_ardour/nsm.cc | 4 ++-- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/ardour_ui_startup.cc b/gtk2_ardour/ardour_ui_startup.cc index 98fd532363..dc7060a4b6 100644 --- a/gtk2_ardour/ardour_ui_startup.cc +++ b/gtk2_ardour/ardour_ui_startup.cc @@ -70,6 +70,7 @@ #include "nsm.h" #include "opts.h" #include "pingback.h" +#include "plugin_scan_dialog.h" #include "public_editor.h" #include "splash.h" @@ -412,8 +413,9 @@ ARDOUR_UI::nsm_init () nsm = 0; return 0; } - // wait for open command from nsm server - for ( i = 0; i < 5000; ++i) { + + /* wait for open command from nsm server */ + for (i = 0; i < 5000; ++i) { nsm->check (); Glib::usleep (1000); if (nsm->client_id ()) { @@ -510,6 +512,9 @@ ARDOUR_UI::starting () return -1; } else { + if (nsm) { + return 0; + } startup_fsm = new StartupFSM (*amd); startup_fsm->signal_response().connect (sigc::mem_fun (*this, &ARDOUR_UI::sfsm_response)); @@ -678,6 +683,7 @@ ARDOUR_UI::load_from_application_api (const std::string& path) return; } + /* Cancel SessionDialog if it's visible to make OSX delegates work. * * ARDOUR_UI::starting connects app->ShouldLoad signal and then shows a SessionDialog @@ -698,11 +704,30 @@ ARDOUR_UI::load_from_application_api (const std::string& path) return; } + if (nsm) { + AudioEngine::instance()->set_backend("JACK", "", ""); + if (!AudioEngine::instance()->running()) { + if (AudioEngine::instance()->start()) { + return; + } + } + + PluginScanDialog psd (true, false); + psd.start (); + + post_engine (); + } + /* the mechanisms that can result is this being called are only * possible for existing sessions. */ if (!Glib::file_test (path, Glib::FILE_TEST_EXISTS)) { + if (nsm) { + BusProfile bus_profile; + bus_profile.master_out_channels = 2; + build_session (path, basename_nosuffix (path), "", bus_profile, true, false); + } return; } diff --git a/gtk2_ardour/nsm.cc b/gtk2_ardour/nsm.cc index 1f2aa5a5da..e29af11f12 100644 --- a/gtk2_ardour/nsm.cc +++ b/gtk2_ardour/nsm.cc @@ -52,8 +52,8 @@ NSM_Client::command_open(const char* name, ARDOUR_COMMAND_LINE::backend_client_name = client_id; /* this appears asynchronous, but almost certainly is - synchronous. However, there's no return value available. - */ + * synchronous. However, there's no return value available. + */ Gtkmm2ext::Application::instance()->ShouldLoad (name); -- cgit v1.2.3