frac32buffer audio input
frac32buffer.bipolar audio output
static const int blepvoices = 8;
const int16_t *oscp[blepvoices];
int16_t amp[blepvoices];
uint32_t nextvoice;
int32_t in1;
int32_t in2;
int32_t in3;
int j;
for (j = 0; j < blepvoices; j++)
oscp[j] = &blt[BLEPSIZE - 1];
nextvoice = 0;
in1 = 0;
in2 = 0;
in3 = 0;
int j;
const int16_t *lastblep = &blt[BLEPSIZE - 1];
for (j = 0; j < BUFSIZE; j++) {
int i;
int in0 = inlet_in[j] >> 2;
int32_t sum = 0;
if ((in0 > 0) && (in1 < 0)) { // dispatch
// rising
nextvoice = (nextvoice + 1) & (blepvoices - 1);
int32_t x = ((in0 << 6) / (in0 - in1));
oscp[nextvoice] = &blt[x];
amp[nextvoice] = (in0 - in1) >> 16;
} else if ((in0 < 0) && (in1 > 0)) { // dispatch
// falling
nextvoice = (nextvoice + 1) & (blepvoices - 1);
int32_t x = ((in0 << 6) / (in0 - in1));
oscp[nextvoice] = &blt[x];
amp[nextvoice] = (in1 - in0) >> 16;
}
sum = (in3 > 0) ? in3 >> 1 : -in3 >> 1;
in3 = in2;
in2 = in1;
in1 = in0;
for (i = 0; i < blepvoices; i++) { // sample
const int16_t *t = oscp[i];
sum += (*t) * amp[i];
t += 64;
if (t >= lastblep)
t = lastblep;
oscp[i] = t;
}
outlet_out[j] = sum << 2;
}