frac32buffer audio
frac32 pitch
frac32 khz
int32 samples
int32 base
int32_t val;
int32_t vbl;
int32_t vcl;
int ttrig;
int strig;
uint64_t timer;
float32_t held;
uint32_t hold;
uint32_t hild;
uint32_t count;
uint32_t caunt;
float32_t khz;
float32_t base;
int on;
Float_t f;
int32_t r1;
int32_t r2;
float32_t LOG1;
float32_t LOG2;
float32_t LOG3;
f.f = 2 << 21;
r1 = ((f.parts.exponent & 0x7F) - 18) << 24;
r2 = logt[f.parts.mantissa >> 15] << 10;
LOG3 = r1 + r2;
held = (float32_t)hild;
khz = ((48 / (held / 16)));
base = ((float32_t)(param_base)) / 1000;
outlet_samples = held;
outlet_khz = khz * (1 << 21);
f.f = khz * (1 << 21);
r1 = ((f.parts.exponent & 0x7F) - 18) << 24;
r2 = logt[f.parts.mantissa >> 15] << 10;
LOG1 = r1 + r2;
f.f = base * (1 << 21);
r1 = ((f.parts.exponent & 0x7F) - 18) << 24;
r2 = logt[f.parts.mantissa >> 15] << 10;
LOG2 = r1 + r2;
// outlet_pitch=((log(khz)-log(base))/log(2))*(12<<21);
outlet_pitch = ((LOG1 - LOG2) / LOG3) * (36 << 21);
vbl = vbl + ((inlet_audio - vbl) >> 9);
val = val + (((vbl << 3) - val) >> 9);
if ((val > 0) && !ttrig) {
ttrig = 1;
count += 1;
count = count & 15;
} else if (val <= 0) {
ttrig = 0;
}
if ((count == 15) && !strig) {
strig = 1;
hild = (timer + (caunt << 31));
timer = 0;
caunt = 0;
} else if (count < 15) {
strig = 0;
}
timer += 1;
if (timer > (1 << 31)) {
timer = 0;
caunt += 1;
}