None
None
bool32.mom do
int32 minHarm
objref table
uint32_t phase;
int i;
int j;
int32_t sum;
int32_t r;
int32_t posWidth;
int32_t position;
int32_t prev;
int ctrig;
int create;
int32_t Pos;
int k;
int32_t start;
float32_t A;
float32_t B;
uint32_t PM;
int DO;
int32_t preset;
DO = 1;
preset = 32;
preset += 1;
preset = preset > 32 ? 32 : preset;
if ((param_do > 0) && !create) {
preset = 0;
create = 1;
} else if (param_do == 0) {
create = 0;
}
if (preset < (32)) {
int32_t max = (((uint32_t)(GenerateRandomNumber())) & 63) + param_minHarm;
int32_t harmonics =
(((uint32_t)(GenerateRandomNumber())) & 31) + param_minHarm;
int32_t minDiv = 1;
int32_t damp = (((uint32_t)(GenerateRandomNumber())) & 1) + 1;
Pos = (((uint32_t)(GenerateRandomNumber())) >> 6) + (16 << 21);
start = (((uint32_t)(GenerateRandomNumber())) >> 6) + (16 << 21);
for (i = 0; i < attr_table.LENGTH; i++) {
attr_table.array[i + preset * attr_table.LENGTH] = 0;
}
for (j = 0; j < harmonics; j++) {
int32_t jump = (((uint32_t)(GenerateRandomNumber())) & 63) + 1;
k = (j * jump - (j * jump / max) * max);
position = ((j + 1) * Pos << 4);
SINE2TINTERP(position, posWidth)
for (i = 0; i < attr_table.LENGTH; i++) {
SINE2TINTERP((i << 32 - attr_table.LENGTHPOW) / minDiv * (k + minDiv) -
(start << 3) * (k + minDiv),
r)
attr_table.array[i + preset * attr_table.LENGTH] +=
___SMMUL(r >> 3, posWidth >> 3) / (1 + k * damp);
}
}
}
if (preset == (31)) {
attr_table.Do = 1;
}