From 4b9289e17e64431041bc50ff00f0cd64e56e752c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 9 Aug 2013 18:06:08 -0400 Subject: [PATCH] don't waste time with sending MTC or MMC after stop if we're disconnected from the engine. Also, add note about threading oddities with send_mmc_locate() being called from ::non_realtime_stop() which gets called from a *realtime* context. --- libs/ardour/session_transport.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 44a885cd1c..1e492741b8 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -609,12 +609,23 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished) have_looped = false; - if (!_engine.freewheeling()) { + /* don't bother with this stuff if we're disconnected from the engine, + because there will be no process callbacks to deliver stuff from + */ + + if (_engine.connected() && !_engine.freewheeling()) { // need to queue this in the next RT cycle _send_timecode_update = true; if (!dynamic_cast(_slave)) { AudioEngine::instance()->mmc().send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdStop)); + + /* This (::non_realtime_stop()) gets called by main + process thread, which will lead to confusion + when calling AsyncMIDIPort::write(). + + Something must be done. XXX + */ send_mmc_locate (_transport_frame); } }