bool32.rising random
frac32 maximum
frac32buffer wave
frac32buffer outR
int32 length
bool32.mom random
frac32.u.map maximum
frac32.u.map minimum
objref delayname1
objref delayname2
int32_t _val[16];
int32_t _vol[16];
uint32_t _pan[16];
uint32_t _com[16];
int32_t _sam1[16];
int32_t _sam2[16];
int ntrig;
int8_t lng;
int i;
uint32_t _delay1[16];
uint32_t _delay2[16];
int32_t sumL;
int32_t sumR;
int32_t mad;
int32_t mid;
for (i = 0; i < 16; i++)
_val[i] = (GenerateRandomNumber()) >> 5;
{}
for (i = 0; i < 16; i++)
_vol[i] = (GenerateRandomNumber()) >> 5;
{}
for (i = 0; i < 16; i++)
_pan[i] = (GenerateRandomNumber()) >> 5;
{}
for (i = 0; i < 16; i++)
_com[i] = (1 << 27) - _pan[i];
{}
ntrig = 0;
lng = param_length;
int32_t width = param_maximum + inlet_maximum - param_minimum;
if (((param_random + inlet_random) >= 1) && (!(ntrig))) {
for (i = 0; i < lng; i++)
_val[i] = ((GenerateRandomNumber()) >> 5);
{}
for (i = 0; i < lng; i++)
_vol[i] = ((GenerateRandomNumber()) >> 5);
{}
for (i = 0; i < lng; i++)
_pan[i] = ((GenerateRandomNumber()) >> 5);
{}
for (i = 0; i < lng; i++)
_com[i] = (1 << 27) - _pan[i];
{}
ntrig = 1;
} else if (!((param_random + inlet_random) >= 1)) {
ntrig = 0;
}
mad = mad + ((param_minimum - mad) >> 13);
mid = mid + ((width - mid) >> 1);
sumL = 0;
sumR = 0;
for (i = 0; i < lng; i++) {
_delay1[i] = attr_delayname1.writepos -
(__USAT(___SMMUL(mid << 3, (_val[i]) << 2) + mad, 27) >>
(27 - attr_delayname1.LENGTHPOW)) -
BUFSIZE + buffer_index;
_delay2[i] = attr_delayname2.writepos -
(__USAT(___SMMUL(mid << 3, (_val[i]) << 2) + mad, 27) >>
(27 - attr_delayname2.LENGTHPOW)) -
BUFSIZE + buffer_index;
}
for (i = 0; i < lng; i++)
_sam1[i] =
(___SMMUL(
(attr_delayname1.array[(_delay1[i]) & attr_delayname1.LENGTHMASK]
<< 14)
<< 3,
_vol[i] << 2)) /
(1 + lng / 2);
{}
for (i = 0; i < lng; i++)
_sam2[i] =
(___SMMUL(
(attr_delayname2.array[(_delay2[i]) & attr_delayname2.LENGTHMASK]
<< 14)
<< 3,
_vol[i] << 2)) /
(1 + lng / 2);
{}
for (i = 0; i < lng; i++) {
sumL += ___SMMUL((_sam1[i]) << 3, (_pan[i]) << 4);
{}
}
for (i = 0; i < lng; i++) {
sumR += ___SMMUL((_sam2[i]) << 3, (_com[i]) << 4);
{}
}
outlet_outL = sumL;
outlet_outR = sumR;