From 44440f93163c02c1a217c2a28cbcd7c84ac3b148 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 27 Jan 2020 20:26:06 +0100 Subject: Add new requirements from AudioEngine::stop to ::drop_backend This fixes an issue that after changing backends (::set_backend), the session-transport was in inconsistent state. If it was rolling, it continued to roll with "stop" being unavailable. --- libs/ardour/audioengine.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'libs') diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 1fcf285437..7f4dbdfa5a 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -896,12 +896,22 @@ void AudioEngine::drop_backend () { if (_backend) { + /* see also ::stop() */ _backend->stop (); - // Stopped is needed for Graph to explicitly terminate threads + _running = false; + if (_session && !_session->loading() && !_session->deletion_in_progress()) { + // it's not a halt, but should be handled the same way: + // disable record, stop transport and I/O processign but save the data. + _session->engine_halted (); + } + Port::PortDrop (); /* EMIT SIGNAL */ + TransportMasterManager& tmm (TransportMasterManager::instance()); + tmm.engine_stopped (); + + /* Stopped is needed for Graph to explicitly terminate threads */ Stopped (); /* EMIT SIGNAL */ _backend->drop_device (); _backend.reset (); - _running = false; } } -- cgit v1.2.3