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].
This commit is contained in:
Robin Gareus 2020-04-27 21:03:13 +02:00
parent c56e99cd09
commit 2587ad6dc3
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -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 */