13
0

change return type on {disconnect_from,reconnect_to}_engine() and make public so that we can use these when doing intentional disconnects without popping up the "HALTED" dialog

This commit is contained in:
Paul Davis 2013-09-17 21:07:14 -04:00
parent b7c15bc9fd
commit c698ada035
2 changed files with 11 additions and 6 deletions

View File

@ -3786,7 +3786,7 @@ audio may be played at the wrong sample rate.\n"), desired, PROGRAM_NAME, actual
return 1; return 1;
} }
void int
ARDOUR_UI::disconnect_from_engine () ARDOUR_UI::disconnect_from_engine ()
{ {
/* drop connection to AudioEngine::Halted so that we don't act /* drop connection to AudioEngine::Halted so that we don't act
@ -3795,24 +3795,28 @@ ARDOUR_UI::disconnect_from_engine ()
halt_connection.disconnect (); halt_connection.disconnect ();
if (AudioEngine::instance()->stop ()) { if (AudioEngine::instance()->stop ()) {
MessageDialog msg (*editor, _("Could not disconnect from JACK")); MessageDialog msg (*editor, _("Could not disconnect from Audio/MIDI engine"));
msg.run (); msg.run ();
return -1;
} else { } else {
AudioEngine::instance()->Halted.connect_same_thread (halt_connection, boost::bind (&ARDOUR_UI::engine_halted, this, _1, false)); AudioEngine::instance()->Halted.connect_same_thread (halt_connection, boost::bind (&ARDOUR_UI::engine_halted, this, _1, false));
} }
update_sample_rate (0); update_sample_rate (0);
return 0;
} }
void int
ARDOUR_UI::reconnect_to_engine () ARDOUR_UI::reconnect_to_engine ()
{ {
if (AudioEngine::instance()->start ()) { if (AudioEngine::instance()->start ()) {
MessageDialog msg (*editor, _("Could not reconnect to JACK")); MessageDialog msg (*editor, _("Could not reconnect to the Audio/MIDI engine"));
msg.run (); msg.run ();
return -1;
} }
update_sample_rate (0); update_sample_rate (0);
return 0;
} }
void void

View File

@ -289,6 +289,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
const std::string& announce_string() const { return _announce_string; } const std::string& announce_string() const { return _announce_string; }
int disconnect_from_engine ();
int reconnect_to_engine ();
protected: protected:
friend class PublicEditor; friend class PublicEditor;
@ -667,8 +670,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
int pending_state_dialog (); int pending_state_dialog ();
int sr_mismatch_dialog (ARDOUR::framecnt_t, ARDOUR::framecnt_t); int sr_mismatch_dialog (ARDOUR::framecnt_t, ARDOUR::framecnt_t);
void disconnect_from_engine ();
void reconnect_to_engine ();
void set_engine_buffer_size (ARDOUR::pframes_t); void set_engine_buffer_size (ARDOUR::pframes_t);
Gtk::MenuItem* jack_disconnect_item; Gtk::MenuItem* jack_disconnect_item;