summaryrefslogtreecommitdiff
path: root/libs/ardour/route.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-04-27 21:03:13 +0200
committerRobin Gareus <robin@gareus.org>2020-04-27 23:10:21 +0200
commit2587ad6dc3ad5c3ae16ea70155a5e72dba60e78b (patch)
tree37ca64fd138a643a881ea83c9b7a619acb0b1ce4 /libs/ardour/route.cc
parentc56e99cd098d4bd59bc3db94e0a34d18090d93e8 (diff)
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].
Diffstat (limited to 'libs/ardour/route.cc')
-rw-r--r--libs/ardour/route.cc14
1 files changed, 11 insertions, 3 deletions
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 */