frac32 detuneStack
frac32 detuneWave
frac32.bipolar pitch
frac32buffer frequency
int32 waveform
int32 waves
int32 wavestep
int32 harmonics
int32 harmstep
frac32buffer.bipolar sine wave
frac32.s.map.pitch root
int32 stack
int32 waveform
int32 waves
int32 wavestep
int32 harmonics
int32 harmstep
int32 maxharm
frac32.s.map detuneStack
frac32.s.map detuneWave
objref table
uint32_t Phase[32];
int32_t read1[32];
int32_t freq[32];
int16_t preset[32];
int i;
int32_t smooth;
int32_t Freq;
int16_t mpreset;
int waves = (param_waves + inlet_waves) & 31;
waves = waves > 0 ? waves : 1;
int32_t wavestep = (param_wavestep + inlet_wavestep) & 1023;
int harmstep = (param_harmstep + inlet_harmstep) & 31;
int harmonics = (param_harmonics + inlet_harmonics) & 31;
harmonics = harmonics > 0 ? harmonics : 1;
int k;
int M;
int32_t detuneStack =
(param_detuneStack + inlet_detuneStack) / (param_stack / waves);
int32_t detuneWave = (param_detuneWave + inlet_detuneWave) / waves;
for (i = 0; i < param_stack; i++) {
M = i * waves / param_stack;
k = i - M * param_stack / waves;
MTOFEXTENDED(param_root + inlet_pitch + (detuneStack >> 8) * k +
(detuneWave >> 8) * M,
freq[i]);
int HARM = ((i * harmonics / param_stack) * harmstep);
HARM = HARM - (HARM / (param_maxharm)) * (param_maxharm);
freq[i] = freq[i] * (1 + HARM);
mpreset = (param_waveform + inlet_waveform) & 1023;
preset[i] = (mpreset + (i * waves / param_stack) * wavestep) << 10;
}
int32_t volume = (1 << 31) / (1 + param_stack);
int32_t sum = 0;
for (i = 0; i < param_stack; i++) {
Freq = freq[i] + ___SMMUL(inlet_linFM << 3, freq[i] << 3);
Phase[i] += freq[i];
sum += attr_table.array[(((Phase[i] >> 22) & 1023) + preset[i]) &
attr_table.LENGTHMASK] >>
3;
}
outlet_wave = ___SMMUL(sum << 3, volume);