From de042dcde763427ace79cb33ad2f1fd7770b2d33 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 27 Nov 2025 01:31:27 +0100 Subject: [PATCH] De-click External Sends --- libs/ardour/delivery.cc | 11 ++++++++++- libs/ardour/send.cc | 8 ++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index f1092cebfd..e3845afb87 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -322,7 +322,11 @@ Delivery::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample { assert (_output); - if (!check_active()) { + /* Do not use check_active() here, because we need to continue running + * until the gain has gone to zero. + */ + + if (!_active && !_pending_active) { _output->silence (nframes); return; } @@ -347,6 +351,11 @@ Delivery::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample // which cannot do this. tgain = target_gain (); + const bool converged = fabsf (_current_gain - tgain) < GAIN_COEFF_DELTA; + + if (converged) { + _active = _pending_active; + } if (tgain != _current_gain) { /* target gain has changed */ diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index 6e6af79eea..d6714fa509 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -151,7 +151,7 @@ Send::deactivate () samplecnt_t Send::signal_latency () const { - if (!_pending_active) { + if (!_pending_active && !_active) { return 0; } if (_delay_out > _delay_in) { @@ -242,7 +242,11 @@ Send::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, do return; } - if (!check_active()) { + /* Do not use check_active() here, because we need to continue running + * until the gain has gone to zero. + */ + + if (!_active && !_pending_active) { _meter->reset (); _output->silence (nframes); return;