From 42dc033636bb60a6caee78eba8cb27a31ca46b08 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 7 Mar 2024 00:56:20 +0100 Subject: [PATCH] Vapor: work-around stem export alignment This is a somewhat fragile solution to ensure that processor reset happens in the same cycle in which the actual data arrives at the start of the cycle. --- libs/ardour/surround_return.cc | 10 +++++++++- share/scripts/_adm_render.lua | 14 -------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/libs/ardour/surround_return.cc b/libs/ardour/surround_return.cc index 0db433c278..f66f841166 100644 --- a/libs/ardour/surround_return.cc +++ b/libs/ardour/surround_return.cc @@ -398,6 +398,13 @@ SurroundReturn::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_ } if (_sync_and_align) { + if (!_rolling && start_sample != end_sample) { + samplecnt_t latency_preroll = _session.remaining_latency_preroll (); + if (nframes + playback_offset () <= latency_preroll) { + end_sample = start_sample; + speed = 0; + } + } if (!_rolling && start_sample != end_sample) { _delaybuffers.flush (); _surround_processor->deactivate(); @@ -420,6 +427,8 @@ SurroundReturn::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_ bool with_bed = _with_bed; + samplecnt_t latency = effective_latency (); + bufs.set_count (_configured_output); _surround_bufs.silence (nframes, 0); @@ -438,7 +447,6 @@ SurroundReturn::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_ } timepos_t unused_start, unused_end; - samplecnt_t latency = effective_latency (); for (uint32_t s = 0; s < ss->bufs ().count ().n_audio (); ++s, ++cid) { diff --git a/share/scripts/_adm_render.lua b/share/scripts/_adm_render.lua index 9bcbe7db4e..953d8bb803 100644 --- a/share/scripts/_adm_render.lua +++ b/share/scripts/_adm_render.lua @@ -6,23 +6,9 @@ ardour { } function factory () return function () - -- ignore input systemic latency, no additional pre-roll - -- to fill buffers with input. - for r in Session:get_tracks():iter() do - r:input():disconnect_all (nil) - end - -- make surround-return announce additional latency to the next 512 -- cycle boundary (and delay the output accordingly). Session:surround_master():surround_return():set_sync_and_align (true) - - -- Mixbus: enforce latency pre-roll to be >= 1505 (latency of Atmos renderer) - -- this allows the Stem Export the Surround Bus. - -- (Mixbus tracks are aligned to master-out, not surrround out) - if Session:master_out().ch_post then - Session:master_out():ch_post ():to_latent():set_user_latency (1505) - end - end end function icon (params) return function (ctx, width, height, fg)