115 if (x < -1.0 || x >= 1.0)
return 0.0;
116 if (x < 0.0)
return 0.5 * x * x + x + 0.5;
117 return x - 0.5 * x * x - 0.5;
130 if (x < -1.0 || x >= 1.0)
return 0.0;
131 if (x < 0.0)
return x * x * x / 6.0 + 0.5 * x * x + 0.5 * x + 1.0 / 6.0;
132 return 0.5 * x * x - x * x * x / 6.0 - 0.5 * x + 1.0 / 6.0;
178 if (!(d >= 0.0 && d <= 1.0))
return {0.0, 0.0};
181 const double before = 0.5 * d * d - d + 0.5;
183 const double x = 1.0 - d;
184 const double after = x - 0.5 * x * x - 0.5;
185 return {height * before, height * after};
207 if (!(d >= 0.0 && d <= 1.0))
return {0.0, 0.0};
239 const double d = 1.0 - phase_after / increment;
Correction poly_blep(double d, double height) noexcept
polyBLEP correction for a step in the VALUE.
Definition blep.hpp:177
Correction poly_blamp(double d, double slope_change) noexcept
polyBLAMP correction for a break in the SLOPE.
Definition blep.hpp:206
double wrap_position(double phase_after, double increment) noexcept
Sub-sample position of a period wrap, for a phase accumulator that has just wrapped through its bound...
Definition blep.hpp:237
constexpr double kNoDiscontinuity
A sub-sample position that means "no discontinuity here".
Definition blep.hpp:80
double blep_residual(double x) noexcept
Unit BLEP residual at x, the signed distance from the discontinuity to the sample,...
Definition blep.hpp:114
double blamp_residual(double x) noexcept
Unit BLAMP residual at x — the integral of blep_residual, and the correction that turns a trivial ram...
Definition blep.hpp:129
A discontinuity's correction, split across the two samples it touches.
Definition blep.hpp:89
double after
Add to the sample following it.
Definition blep.hpp:93
double before
Add to the sample preceding the discontinuity.
Definition blep.hpp:91