Hi Jaffa. I noticed that Technobear has already shown you how to avoid looping outputs to inputs, but since I just got your env\ADSR1 code working without the loopback, I figured I'd post the code here, just in case.
Basically, I created a new int32_t called loopVal and replaced your outlet_e and and inlet_e with the variable.
Great libraries, thank you!
// vca
step = (loopVal - prev)>>4;
int32_t i = prev;
prev = loopVal;
//env
if ((inlet_g>0) && !ntrig) {
stage = 1;
ntrig = 1;
}
if (!(inlet_g>0) && ntrig) {
stage = 0;
ntrig = 0;
}
if (stage == 0){
int32_t r1;
int32_t r2;
MTOF(- param_r - inlet_r, r1);
r1 = 0x7FFFFFFF - (r1 >> 2);
val = ___SMMUL(val,r1)<<1;
} else if (stage == 1){
int32_t a;
MTOF(- param_a - inlet_a,a);
a = a >> 2;
val = val + a;
if (val<0) {
val =0x7FFFFFFF;
stage = 2;
}
} else if (stage == 2) {
int32_t s = __USAT(param_s + inlet_s, 27);
int32_t d;
MTOF(- param_d - inlet_d, d);
d = 0x7FFFFFFF - (d >> 2);
val = (s<<4) + (___SMMUL(val - (s<<4),d)<<1);
}
loopVal = val>>4;