From 08d4350ddfb827b79418638ab525ec1ef5565c31 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 21 May 2020 16:11:39 +0200 Subject: NSM: Use session's rate when starting JACK Also log if jackd cannot be started or reached instead of silently terminating. --- gtk2_ardour/ardour_ui_startup.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/ardour_ui_startup.cc b/gtk2_ardour/ardour_ui_startup.cc index dc7060a4b6..ca470524c3 100644 --- a/gtk2_ardour/ardour_ui_startup.cc +++ b/gtk2_ardour/ardour_ui_startup.cc @@ -705,9 +705,26 @@ ARDOUR_UI::load_from_application_api (const std::string& path) } if (nsm) { - AudioEngine::instance()->set_backend("JACK", "", ""); + if (!AudioEngine::instance()->set_backend("JACK", "", "")) { + error << _("NSM: The JACK backend is mandatory and can not be loaded.") << endmsg; + return; + } + if (!AudioEngine::instance()->running()) { + /* this auto-starts jackd with recent settings + * TODO: if Glib::file_test (path, Glib::FILE_TEST_IS_DIR) + * query sample-rate of the session and use it. + */ + if (Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) { + float sr; + SampleFormat sf; + string pv; + if (0 == Session::get_info_from_path (Glib::build_filename (path, basename_nosuffix (path) + statefile_suffix), sr, sf, pv)) { + ARDOUR::AudioEngine::instance ()->set_sample_rate (sr); + } + } if (AudioEngine::instance()->start()) { + error << string_compose (_("NSM: %1 cannot connect to the JACK server. Please start jackd first."), PROGRAM_NAME) << endmsg; return; } } -- cgit v1.2.3