From ed3fff32a66066bcf1dae45189993c3908e7fcee Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Sat, 29 Jul 2023 22:25:03 +0100 Subject: [PATCH] Smooth: Jump to target value on first step --- source/src/node/processors/smooth.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/src/node/processors/smooth.cpp b/source/src/node/processors/smooth.cpp index 20c14314..d5e5f031 100644 --- a/source/src/node/processors/smooth.cpp +++ b/source/src/node/processors/smooth.cpp @@ -13,11 +13,22 @@ Smooth::Smooth(NodeRef input, NodeRef smooth) void Smooth::alloc() { - this->values.resize(this->num_output_channels_allocated); + this->values.resize(this->num_output_channels_allocated, std::numeric_limits::max()); } void Smooth::process(Buffer &out, int num_frames) { + /*-------------------------------------------------------------------------------- + * On first step, jump immediately to value. + *-------------------------------------------------------------------------------*/ + if (values[0] == std::numeric_limits::max()) + { + for (int channel = 0; channel < this->num_output_channels; channel++) + { + values[channel] = input->out[channel][0]; + } + } + for (int channel = 0; channel < this->num_output_channels; channel++) { for (int frame = 0; frame < num_frames; frame++)