-#undef DEBUG_LATENCY
-#ifdef DEBUG_LATENCY
- cerr << "\n---------------------------------\nUPDATE LATENCY\n";
-#endif
-
- boost::shared_ptr<RouteList> r = routes.reader ();
-
- for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
-
- if (with_stop) {
- (*i)->handle_transport_stopped (abort, (ptw & PostTransportLocate), (!(ptw & PostTransportLocate) || pending_locate_flush));
- }
-
- nframes_t old_latency = (*i)->output()->signal_latency ();
- nframes_t track_latency = (*i)->update_total_latency ();
-
- if (old_latency != track_latency) {
- (*i)->input()->update_port_total_latencies ();
- (*i)->output()->update_port_total_latencies ();
- update_jack = true;
- }
-
- if (!(*i)->is_hidden() && ((*i)->active())) {
- _worst_track_latency = max (_worst_track_latency, track_latency);
- }
- }
-
- if (update_jack) {
- _engine.update_total_latencies ();
- }
-
-#ifdef DEBUG_LATENCY
- cerr << "\tworst was " << _worst_track_latency << endl;
-#endif
-
- for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
- (*i)->set_latency_delay (_worst_track_latency);
- }
-
- set_worst_io_latencies ();
-
- /* reflect any changes in latencies into capture offsets
- */
-
- boost::shared_ptr<RouteList> rl = routes.reader();
- for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
- boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
- if (tr) {
- tr->set_capture_offset ();
- }
- }