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
This commit is contained in:
Paul Davis 2007-04-27 03:00:44 +00:00
parent a841933ac7
commit 88be1a799f
3 changed files with 40 additions and 6 deletions

View file

@ -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) {

View file

@ -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 ();

View file

@ -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 */
}