From 1e4c1388c32d76c99f111b58b0820b8d1ecd6fbe Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 14 Mar 2011 20:33:47 +0000 Subject: more fun and games with latency compensation, and so forth ... not done yet git-svn-id: svn://localhost/ardour2/branches/3.0@9149 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/session_transport.cc | 70 ++++------------------------------------ 1 file changed, 6 insertions(+), 64 deletions(-) (limited to 'libs/ardour/session_transport.cc') diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 26a4592f0e..252262efcd 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -490,7 +490,11 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished) } if (_engine.running()) { - update_latency_compensation (true, abort); + PostTransportWork ptw = post_transport_work (); + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + (*i)->nonrealtime_handle_transport_stopped (abort, (ptw & PostTransportLocate), (!(ptw & PostTransportLocate) || pending_locate_flush)); + } + update_latency_compensation (); } bool const auto_return_enabled = @@ -1461,72 +1465,10 @@ Session::route_processors_changed (RouteProcessorChange c) return; } - update_latency_compensation (false, false); + update_latency_compensation (); resort_routes (); } -void -Session::update_latency_compensation (bool with_stop, bool abort, bool force_whole_graph) -{ - bool update_jack = false; - PostTransportWork ptw; - - if (_state_of_the_state & Deletion) { - return; - } - - _worst_track_latency = 0; - ptw = post_transport_work(); - - DEBUG_TRACE(DEBUG::Latency, "---------------------------- update latency compensation\n\n") - - boost::shared_ptr r = routes.reader (); - - for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - - if (with_stop) { - (*i)->nonrealtime_handle_transport_stopped (abort, (ptw & PostTransportLocate), (!(ptw & PostTransportLocate) || pending_locate_flush)); - } - - framecnt_t old_latency = (*i)->signal_latency (); - framecnt_t new_latency = (*i)->update_signal_latency (); - - if (old_latency != new_latency) { - update_jack = true; - } - - if (!(*i)->is_hidden() && ((*i)->active())) { - _worst_track_latency = max (_worst_track_latency, new_latency); - } - } - - if (force_whole_graph || update_jack) { - /* trigger a full recompute of latency numbers for the graph - */ - _engine.update_total_latencies (); - } - - DEBUG_TRACE(DEBUG::Latency, string_compose("worst case route internal latency was %1\n", _worst_track_latency)); - - for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - (*i)->set_latency_compensation (_worst_track_latency); - } - - set_worst_io_latencies (); - - /* reflect any changes in latencies into capture offsets - */ - - boost::shared_ptr rl = routes.reader(); - for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { - boost::shared_ptr tr = boost::dynamic_pointer_cast (*i); - if (tr) { - tr->set_capture_offset (); - } - } - DEBUG_TRACE(DEBUG::Latency, "---------------------------- DONE update latency compensation\n\n") -} - void Session::allow_auto_play (bool yn) { -- cgit v1.2.3