13
0

Add EngineControl::stop_engine method to show errors when stopping engine

This replaces using ARDOUR_UI::disconnect_from_session which is only used by the
EngineControl class. ARDOUR_UI::disconnect_from_session also disconnects from
the AudioEngine::Halted signal which seems unnecessary as Halted is not emitted
when stopping the engine and calling update_sample_rate() which is already
handled when the AudioEngine::Stopped signal is emitted.
This commit is contained in:
Tim Mayberry 2015-10-03 14:09:45 +10:00
parent 1195aeb64e
commit cd4dd08931
2 changed files with 17 additions and 5 deletions

View File

@ -419,6 +419,18 @@ EngineControl::start_engine ()
return true;
}
bool
EngineControl::stop_engine ()
{
if (ARDOUR::AudioEngine::instance()->stop()) {
MessageDialog msg(*this,
ARDOUR::AudioEngine::instance()->get_last_backend_error());
msg.run();
return false;
}
return true;
}
void
EngineControl::on_response (int response_id)
{
@ -2260,13 +2272,12 @@ EngineControl::push_state_to_backend (bool start)
if (was_running) {
if (restart_required) {
if (ARDOUR_UI::instance()->disconnect_from_engine ()) {
if (ARDOUR::AudioEngine::instance()->stop()) {
return -1;
}
}
}
if (change_driver && backend->set_driver (get_driver())) {
error << string_compose (_("Cannot set driver to %1"), get_driver()) << endmsg;
return -1;
@ -2578,7 +2589,7 @@ EngineControl::on_switch_page (GtkNotebookPage*, guint page_num)
if (ARDOUR::AudioEngine::instance()->running()) {
// TODO - mark as 'stopped for latency
ARDOUR_UI::instance()->disconnect_from_engine ();
stop_engine ();
}
{
@ -2885,9 +2896,9 @@ void
EngineControl::connect_disconnect_click()
{
if (ARDOUR::AudioEngine::instance()->running()) {
ARDOUR_UI::instance()->disconnect_from_engine ();
stop_engine ();
} else {
ARDOUR_UI::instance()->reconnect_to_engine ();
start_engine ();
}
}

View File

@ -300,6 +300,7 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList {
void post_push ();
void update_sensitivity ();
bool start_engine ();
bool stop_engine ();
/* latency measurement */
void latency_button_clicked ();