ref: d57d77b890e2c660d628d495d992cc3cc33992f9
parent: 24675fa3b52525e4383214a69cec0d5cae6d1e51
author: Matthew Wang <mjw7@princeton.edu>
date: Wed Sep 30 14:42:07 EDT 2020
clip vzfilter freq on init; handling for 0 cfxlen in sampler
--- a/leaf/Src/leaf-filters.c
+++ b/leaf/Src/leaf-filters.c
@@ -1241,7 +1241,7 @@
LEAF* leaf = f->mempool->leaf;
- f->fc = freq;
+ f->fc = LEAF_clip(0.0f, freq, 0.5f * leaf->sampleRate);
f->type = type;
f->G = ONE_OVER_SQRT2;
f->invG = 1.0f/ONE_OVER_SQRT2;
--- a/leaf/Src/leaf-sampling.c
+++ b/leaf/Src/leaf-sampling.c
@@ -383,7 +383,8 @@
buff[c3],
buff[c4],
alpha);
- crossfadeMix = (float) offset / (float) cfxlen;
+ if (cfxlen > 0.0f) crossfadeMix = (float) offset / (float) cfxlen;
+ else crossfadeMix = 0.0f;
}
float flipLength = fabsf(p->flipIdx - p->flipStart);
@@ -525,8 +526,6 @@
}
}
-
-
p->last = sample;
@@ -705,7 +704,8 @@
buff[(f4 * p->channels) + 1],
falpha);
- flipMix = (float) (cfxlen - flipLength) / (float) cfxlen;
+ if (cfxlen > 0) flipMix = (float) (cfxlen - flipLength) / (float) cfxlen;
+ else flipMix = 1.0f;
}
}