summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-05-21 16:11:39 +0200
committerRobin Gareus <robin@gareus.org>2020-05-21 16:11:39 +0200
commit08d4350ddfb827b79418638ab525ec1ef5565c31 (patch)
tree38c1fb6f1e2375c70d50b823bcbe01f9936235ee
parent5d0867ec10a3306c860f4b3d8b2af53af9981d83 (diff)
NSM: Use session's rate when starting JACK
Also log if jackd cannot be started or reached instead of silently terminating.
-rw-r--r--gtk2_ardour/ardour_ui_startup.cc19
1 files changed, 18 insertions, 1 deletions
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;
}
}