int32 count
int32 max
frac32 out
frac32.s.map rnd
frac32.u.map CV
frac32.s.map.lfopitch rate
int32 steps
int32 wait
combo size
static const uint32_t LENGTHPOW = (attr_size);
static const uint32_t LENGTH = (1 << attr_size);
static const uint32_t LENGTHMASK = ((1 << attr_size) - 1);
int16_t *array;
int32_t phase;
int ctrig;
int rtrig;
int ftrig;
int rec;
uint32_t cnt1;
uint32_t cnt2;
int32_t pv;
int32_t pc;
int32_t pt;
int32_t A[4];
int32_t TMP;
static int16_t _array[LENGTH] __attribute__((section(".sdram")));
array = &_array[0];
int32_t rate;
MTOFEXTENDED(param_rate, rate)
phase += rate;
if (!(pv == param_CV)) {
rec = 1;
cnt2 = 0;
}
pv = param_CV;
if ((rec > 0) && !ftrig) {
ftrig = 1;
cnt1 = 0;
} else if (rec == 0) {
ftrig = 0;
}
int Do = ((phase > 0) && rec);
if ((Do) && (!rtrig)) {
array[cnt1 & LENGTHMASK] = param_CV >> 12;
cnt1 += 1;
cnt2 += 1;
cnt2 = cnt2 > 2000 ? 2000 : cnt2;
rec = cnt2 > param_wait ? 0 : rec;
rtrig = 1;
} else if (Do == 0) {
rtrig = 0;
}
if ((!(pc == inlet_count)) || (!(pt == inlet_max))) {
int32_t RND = (int32_t)(GenerateRandomNumber());
int32_t tmp = cnt1 - cnt2;
RND = ___SMMUL((RND >> 16) * (tmp) >> 14, param_rnd << 1);
int32_t count = (tmp)*inlet_count / inlet_max * param_steps + RND;
count = count - count / tmp * tmp;
TMP = array[count & LENGTHMASK] << 12;
}
outlet_out = TMP;
pc = inlet_count;
pt = inlet_max;