From 2587ad6dc3ad5c3ae16ea70155a5e72dba60e78b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 27 Apr 2020 21:03:13 +0200 Subject: Ignore unconnected ports for latency-compensation This fixed a false-positive "ambiguous latency" warning for MIDI busses: MIDI track -midi-> MIDI Bus w/instrument -audio|midi-> master The master-bus only has audio inputs, so the MIDI Bus' MIDI out is left unconnected. Its latency does not matter, it can float freely. Previously it was assumed to be zero. So the MIDI Bus' input playback latency range was [0, master-bus playback-latency]. --- libs/ardour/route.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'libs/ardour/route.cc') diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 8def7e4b5c..42e262d169 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -4794,18 +4794,26 @@ Route::update_port_latencies (PortSet& from, PortSet& to, bool playback, samplec all_connections.max = 0; /* iterate over all "from" ports and determine the latency range for all of their - connections to the "outside" (outside of this Route). - */ + * connections to the "outside" (outside of this Route). + */ for (PortSet::iterator p = from.begin(); p != from.end(); ++p) { - LatencyRange range; + if (!p->connected ()) { + /* ignore latency of unconnected ports, not not assume "0", they can float freely */ + continue; + } + LatencyRange range; p->get_connected_latency_range (range, playback); all_connections.min = min (all_connections.min, range.min); all_connections.max = max (all_connections.max, range.max); } + + if (all_connections.min == ~((pframes_t) 0)) { + all_connections.min = 0; + } } /* set the "from" port latencies to the max/min range of all their connections */ -- cgit v1.2.3