summaryrefslogtreecommitdiff
path: root/libs/ardour/route.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-10-30 23:51:53 +0100
committerRobin Gareus <robin@gareus.org>2019-10-30 23:51:53 +0100
commit27a3b93152fe8cdadffcc1f8dc514bc107d70381 (patch)
tree124d6fb459f149c72169051f7f3b5bb192f66ad1 /libs/ardour/route.cc
parente2f5ce6f61e1838070300506aaef5bbd208fe1ab (diff)
Update latency-compensation when re-ordering processors
When re-ordering processors, the route's own latency does not change (at first). But it might if sends or plugins with side-chains a involved.
Diffstat (limited to 'libs/ardour/route.cc')
-rw-r--r--libs/ardour/route.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index eca399302a..c750ca2719 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -2119,6 +2119,44 @@ Route::apply_processor_order (const ProcessorList& new_order)
/* If the meter is in a custom position, find it and make a rough note of its position */
maybe_note_meter_position ();
+
+ /* if any latent plugins were re-ordered and sends or side-chains are present
+ * in the signal-flow, a full latency-recompute is needed.
+ *
+ * The Session will be informed about the new order via
+ * processors_changed()
+ * and test if a full latency-recompute is required by comparing
+ * _signal_latency != ::update_signal_latency();
+ *
+ * Since the route's latency itself does not initially change by
+ * re-ordering, we need to force this:
+ */
+ bool need_latency_recompute = false;
+ for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
+ if (boost::shared_ptr<PortInsert> pi = boost::dynamic_pointer_cast<PortInsert> (*i)) {
+ need_latency_recompute = true;
+ break;
+ } else if (boost::shared_ptr<LatentSend> snd = boost::dynamic_pointer_cast<LatentSend> (*i)) {
+ need_latency_recompute = true;
+ break;
+ } else if (boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (*i)) {
+ if (boost::shared_ptr<IO> pio = pi->sidechain_input ()) {
+ need_latency_recompute = true;
+ break;
+ }
+ }
+ }
+ if (need_latency_recompute) {
+ /* force a change, the correct value will be set
+ * ::update_signal_latency() will be called via
+ *
+ * SIGNAL processors_changed () ->
+ * -> Session::route_processors_changed ()
+ * -> Session::update_latency_compensation ()
+ * -> Route::::update_signal_latency ()
+ */
+ _signal_latency = 0;
+ }
}
void