- if (playback) {
- update_port_latencies (_input->ports (), _output->ports (), true, own_latency);
- } else {
- update_port_latencies (_output->ports (), _input->ports (), false, own_latency);
- }
-}
-
-void
-Route::update_port_latencies (const PortSet& operands, const PortSet& feeders, bool playback, framecnt_t our_latency) const
-{
-#ifdef HAVE_JACK_NEW_LATENCY
-
- /* we assume that all our input ports feed all our output ports. its not
- universally true, but the alternative is way too corner-case to worry about.
- */
-
- jack_latency_range_t all_connections;
-
- all_connections.min = ~((jack_nframes_t) 0);
- all_connections.max = 0;
-
- /* iterate over all feeder ports and determine their relevant latency, taking
- the maximum and minimum across all of them.
- */
-
- for (PortSet::const_iterator p = feeders.begin(); p != feeders.end(); ++p) {
-
- jack_latency_range_t 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);
- }
-
- all_connections.min += our_latency;
- all_connections.max += our_latency;
-
- for (PortSet::const_iterator p = operands.begin(); p != operands.end(); ++p) {
-
- p->set_latency_range (all_connections, playback);
-
- DEBUG_TRACE (DEBUG::Latency, string_compose ("Port %1 %5 latency range %2 .. %3 (including route latency of %4)\n",
- p->name(),
- all_connections.min,
- all_connections.max,
- our_latency,
- (playback ? "PLAYBACK" : "CAPTURE")));
- }
-#endif
+ if (playback) {
+ /* playback: propagate latency from "outside the route" to outputs to inputs */
+ return update_port_latencies (_output->ports (), _input->ports (), true, own_latency);
+ } else {
+ /* capture: propagate latency from "outside the route" to inputs to outputs */
+ return update_port_latencies (_input->ports (), _output->ports (), false, own_latency);
+ }