diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-04-27 03:00:44 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-04-27 03:00:44 +0000 |
commit | 88be1a799fa4bf26fd085aa1b957b818e0e43ea3 (patch) | |
tree | 9666601efd3fdd9fd75e04a25c5e00813204da70 | |
parent | a841933ac7b00716fecb87ccc9fe9148b987f2d1 (diff) |
first pass at no close/open/new when disconnected from JACK, including noting that JACK is disconnected from the shutdown callback
git-svn-id: svn://localhost/ardour2/trunk@1757 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 43 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 2 | ||||
-rw-r--r-- | libs/ardour/audioengine.cc | 1 |
3 files changed, 40 insertions, 6 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 74234bb12a..ca0506878e 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -947,9 +947,30 @@ ARDOUR_UI::filter_ardour_session_dirs (const FileFilter::Info& info) return S_ISREG (statbuf.st_mode); } +bool +ARDOUR_UI::check_audioengine () +{ + if (engine) { + if (!engine->connected()) { + MessageDialog msg (_("Ardour is not connected to JACK\n" + "You cannot open or close sessions in this condition")); + msg.run (); + return false; + } + return true; + } else { + return false; + } +} + void ARDOUR_UI::open_session () { + if (!check_audioengine()) { + return; + + } + /* popup selector window */ if (open_session_selector == 0) { @@ -1751,9 +1772,7 @@ ARDOUR_UI::new_session (std::string predetermined_path) string session_name; string session_path; - if (!engine->connected()) { - MessageDialog msg (_("Ardour is not connected to JACK at this time. Creating new sessions is not possible.")); - msg.run (); + if (!check_audioengine()) { return false; } @@ -1768,10 +1787,8 @@ ARDOUR_UI::new_session (std::string predetermined_path) do { response = new_session_dialog->run (); - if (!engine->connected()) { + if (!check_audioengine()) { new_session_dialog->hide (); - MessageDialog msg (_("Ardour is not connected to JACK at this time. Creating new sessions is not possible.")); - msg.run (); return false; } @@ -1964,6 +1981,10 @@ ARDOUR_UI::new_session (std::string predetermined_path) void ARDOUR_UI::close_session() { + if (!check_audioengine()) { + return; + } + unload_session(); new_session (); } @@ -1975,6 +1996,10 @@ ARDOUR_UI::load_session (const string & path, const string & snap_name, string* int x; session_loaded = false; + if (!check_audioengine()) { + return -1; + } + x = unload_session (); if (x < 0) { @@ -2031,8 +2056,14 @@ ARDOUR_UI::build_session (const string & path, const string & snap_name, Session *new_session; int x; + if (!check_audioengine()) { + return -1; + } + session_loaded = false; + x = unload_session (); + if (x < 0) { return -1; } else if (x > 0) { diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 1ebb7407af..b99c422dca 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -257,6 +257,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI ARDOUR::AudioEngine *engine; ARDOUR::Session *session; + bool check_audioengine(); + Gtk::Tooltips _tooltips; void goto_editor_window (); diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index bb91625583..3654e647a3 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -762,6 +762,7 @@ AudioEngine::halted (void *arg) ae->_running = false; ae->_buffer_size = 0; ae->_frame_rate = 0; + ae->_jack = 0; ae->Halted(); /* EMIT SIGNAL */ } |