Files
soothe2-re/dsp/leveltrack.hpp
T

23 lines
1.1 KiB
C++

#pragma once
#include <cstddef>
// Level-tracker UPDATE (structural transcription, NOTES_LEVEL 2026-08-19f).
// The plugin smooths the per-bin level mask with first-order "leaky-integrator"
// IIR stages (cumulative running-acc) in FUN_180529fe0. Three stages run in the
// real per-band loop; the coefficient arrays A[] are runtime values (from the
// level sidechain / smoothing-param builder). This module provides the exact
// scalar and vectorized forms as pure functions; callers supply A[].
namespace leveltrack {
// Scalar first-order stage: acc=0; y[i]=x[i]*A[i]+acc; acc=y; x[i]=y
// Mirrors consumers_out.txt scalar loop. In-place on x.
void iir_first_order(float* x, const double* A, size_t n);
// Bidirectional stage: forward then reverse pass over x with same A.
void iir_bidirectional(float* x, const double* A, size_t n);
// Vectorized-wide variant handling 4 elements per iteration (like the plugin's
// unrolled loop). Same math, provided for parity tests.
void iir_first_order_unrolled4(float* x, const double* A, size_t n);
} // namespace leveltrack