24#ifndef SBL_DSP_COMP_WAVEFOLD_AA_HPP_
25#define SBL_DSP_COMP_WAVEFOLD_AA_HPP_
46 q = q - 4.0f * floorf(q * 0.25f);
50 return xr * xr * 0.5f + 1.0f;
52 return 2.0f * xr - xr * xr * 0.5f;
67 float k = floorf(q * 0.25f);
74 core = xr * xr * xr * (1.0f / 6.0f) + xr;
77 core = xr * xr - xr * xr * xr * (1.0f / 6.0f) + (1.0f / 3.0f);
80 return core + 6.0f * k;
119 constexpr float EPS = 1e-5f;
120 if (fabsf(dx1) > EPS) {
121 D1 = (F2_x - F2_x1_) / dx1;
132 constexpr float OUTER_EPS = 1e-2f;
133 if (fabsf(dx2) > OUTER_EPS) {
134 y = 2.0f * (D1 - D1_prev_) / dx2;
135 }
else if (fabsf(dx1) > EPS) {
137 y = (F1_x - F1_x1_) / dx1;
156 void process(
float* buf, uint16_t frames,
float depth,
157 const float* depth_buf =
nullptr) {
158 if (depth_buf !=
nullptr) {
159 for (uint16_t i = 0; i < frames; ++i) {
160 buf[i] =
process(buf[i] * depth_buf[i]);
163 for (uint16_t i = 0; i < frames; ++i) {
164 buf[i] =
process(buf[i] * depth);
void process(float *buf, uint16_t frames, float depth, const float *depth_buf=nullptr)
float process(float x)
Process a single sample (pre-multiplied by depth)
static float fold(float x)
The fold function, available for math use (e.g., WavefoldAA antiderivatives)
Compositions: subcircuits of primitives.
float wavefold_antideriv(float x)
float wavefold_antideriv2(float x)