|
|
@@ -15,9 +15,9 @@ https://www.cs.cmu.edu/~eli/papers/icmc01-hardsync.pdf |
|
|
|
void minBlepImpulse(int z, int o, float *output); |
|
|
|
|
|
|
|
|
|
|
|
template <int Z, int O> |
|
|
|
template <int Z, int O, typename T = float> |
|
|
|
struct MinBlepGenerator { |
|
|
|
float buf[2 * Z] = {}; |
|
|
|
T buf[2 * Z] = {}; |
|
|
|
int pos = 0; |
|
|
|
float impulse[2 * Z * O + 1]; |
|
|
|
|
|
|
@@ -27,7 +27,7 @@ struct MinBlepGenerator { |
|
|
|
} |
|
|
|
|
|
|
|
/** Places a discontinuity with magnitude `x` at -1 < p <= 0 relative to the current frame */ |
|
|
|
void insertDiscontinuity(float p, float x) { |
|
|
|
void insertDiscontinuity(float p, T x) { |
|
|
|
if (!(-1 < p && p <= 0)) |
|
|
|
return; |
|
|
|
for (int j = 0; j < 2 * Z; j++) { |
|
|
@@ -37,9 +37,9 @@ struct MinBlepGenerator { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
float process() { |
|
|
|
float v = buf[pos]; |
|
|
|
buf[pos] = 0.f; |
|
|
|
T process() { |
|
|
|
T v = buf[pos]; |
|
|
|
buf[pos] = T(0); |
|
|
|
pos = (pos + 1) % (2 * Z); |
|
|
|
return v; |
|
|
|
} |
|
|
|