diff options
author | Robin Gareus <robin@gareus.org> | 2020-04-26 21:34:26 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-04-26 21:34:26 +0200 |
commit | 31c39ed8696658a0b4d4d7dc7e4ab5880bcecd4d (patch) | |
tree | 52b9bbc6b4c3076c2ca06f5d2303756072203222 /libs/ardour | |
parent | 842e841e0d2479c5012f476655c1481b90fa5d40 (diff) |
Remove duplicate i/o latency calculation
Port and connection changes always imply a latency_callback from
the engine. Worst I/O latency is updated directly in
Session::update_latency() which is called from
AudioEngine::latency_callback.
Explicit subscriptions to route->output()->changed() is not needed
to update the worst I/O latency.
Only set_block_size() needs to to update the I/O latency when
the buffer-size changes.
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/session.h | 3 | ||||
-rw-r--r-- | libs/ardour/session.cc | 61 |
2 files changed, 21 insertions, 43 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index b9c875c95c..ac50c07a29 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1343,14 +1343,11 @@ private: void update_latency (bool playback); bool update_route_latency (bool reverse, bool apply_to_delayline); - void initialize_latencies (); - void set_worst_io_latencies (); void set_worst_output_latency (); void set_worst_input_latency (); void send_latency_compensation_change (); - void set_worst_io_latencies_x (IOChange, void *); void ensure_buffers (ChanCount howmany = ChanCount::ZERO); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 3c0945e033..7518285109 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -2082,32 +2082,33 @@ void Session::set_block_size (pframes_t nframes) { /* the AudioEngine guarantees - that it will not be called while we are also in - ::process(). It is therefore fine to do things that block - here. - */ - - { - current_block_size = nframes; + * that it will not be called while we are also in + * ::process(). It is therefore fine to do things that block + * here. + */ + current_block_size = nframes; - ensure_buffers (); + ensure_buffers (); - boost::shared_ptr<RouteList> r = routes.reader (); + boost::shared_ptr<RouteList> r = routes.reader (); - for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - (*i)->set_block_size (nframes); - } + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + (*i)->set_block_size (nframes); + } - 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_block_size (nframes); - } + 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_block_size (nframes); } - - set_worst_io_latencies (); } + + DEBUG_TRACE (DEBUG::LatencyCompensation, "Session::set_block_size -> update worst i/o latency\n"); + /* when this is called from the auto-connect thread, the process-lock is held */ + Glib::Threads::Mutex::Lock lx (_update_latency_lock); + set_worst_output_latency (); + set_worst_input_latency (); } @@ -3201,7 +3202,6 @@ Session::add_routes_inner (RouteList& new_routes, bool input_auto_connect, bool r->solo_isolate_control()->Changed.connect_same_thread (*this, boost::bind (&Session::route_solo_isolated_changed, this, wpr)); r->mute_control()->Changed.connect_same_thread (*this, boost::bind (&Session::route_mute_changed, this)); - r->output()->changed.connect_same_thread (*this, boost::bind (&Session::set_worst_io_latencies_x, this, _1, _2)); r->processors_changed.connect_same_thread (*this, boost::bind (&Session::route_processors_changed, this, _1)); r->processor_latency_changed.connect_same_thread (*this, boost::bind (&Session::queue_latency_recompute, this)); @@ -6452,15 +6452,6 @@ Session::initialize_latencies () { update_latency (false); update_latency (true); - - set_worst_io_latencies (); -} - -void -Session::set_worst_io_latencies_x (IOChange, void *) -{ - DEBUG_TRACE (DEBUG::LatencyCompensation, "Session::set_worst_io_latencies_x\n"); - set_worst_io_latencies (); } void @@ -6588,16 +6579,6 @@ Session::update_latency (bool playback) } void -Session::set_worst_io_latencies () -{ - DEBUG_TRACE (DEBUG::LatencyCompensation, "Session::set_worst_io_latencies\n"); - /* when this is called from the auto-connect thread, the process-lock is held */ - Glib::Threads::Mutex::Lock lx (_update_latency_lock); - set_worst_output_latency (); - set_worst_input_latency (); -} - -void Session::set_worst_output_latency () { if (inital_connect_or_deletion_in_progress ()) { |