From 58c5f75fc9cda7a8b3282c4ac74dd80f397c91f2 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 11 May 2020 03:42:21 +0200 Subject: [PATCH] Fix TCM requiring port-reconnect when engine restarts An engine restart sends dis-connect messages for the reverse port-mapping (after making the connection): Connect: system:midi_capture_41a56f90 -> ardour:MTC in Connect: system:capture_1 -> ardour:LTC in DisConnect: ardour:MTC in -> system:midi_capture_41a56f90 DisConnect: ardour:LTC in -> system:capture_1 This lead to TransportMaster being marked as inactive. This is likely an issue that should be fixed elsewhere, but in case of JACK, we likely do not have control over this. --- libs/ardour/ltc_slave.cc | 5 ++--- libs/ardour/mtc_slave.cc | 5 ++--- libs/ardour/transport_master.cc | 8 +++----- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/libs/ardour/ltc_slave.cc b/libs/ardour/ltc_slave.cc index 1e8ff2b24e..dc0d1b2669 100644 --- a/libs/ardour/ltc_slave.cc +++ b/libs/ardour/ltc_slave.cc @@ -129,9 +129,8 @@ LTC_TransportMaster::connection_handler (boost::weak_ptr w0, std:: { TransportMaster::connection_handler(w0, n0, w1, n1, con); - boost::shared_ptr p0 = w0.lock (); - boost::shared_ptr p1 = w1.lock (); - if (p0 == _port || p1 == _port) { + boost::shared_ptr p = w1.lock (); + if (p == _port) { resync_latency (false); } } diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc index 834eb0aad1..e228c8cd60 100644 --- a/libs/ardour/mtc_slave.cc +++ b/libs/ardour/mtc_slave.cc @@ -94,9 +94,8 @@ MTC_TransportMaster::connection_handler (boost::weak_ptr w0, std:: { TransportMaster::connection_handler(w0, n0, w1, n1, con); - boost::shared_ptr p0 = w0.lock (); - boost::shared_ptr p1 = w1.lock (); - if (p0 == _port || p1 == _port) { + boost::shared_ptr p = w1.lock (); + if (p == _port) { resync_latency (false); } } diff --git a/libs/ardour/transport_master.cc b/libs/ardour/transport_master.cc index 1794fca354..2faa5dc715 100644 --- a/libs/ardour/transport_master.cc +++ b/libs/ardour/transport_master.cc @@ -164,16 +164,14 @@ TransportMaster::set_name (std::string const & str) } void -TransportMaster::connection_handler (boost::weak_ptr, std::string name1, boost::weak_ptr, std::string name2, bool yn) +TransportMaster::connection_handler (boost::weak_ptr, std::string, boost::weak_ptr w1, std::string, bool yn) { if (!_port) { return; } - const std::string fqn = ARDOUR::AudioEngine::instance()->make_port_name_non_relative (_port->name()); - - if (fqn == name1 || fqn == name2) { - + boost::shared_ptr p = w1.lock (); + if (p == _port) { /* it's about us */ /* XXX technically .. if the user makes an N->1 connection to