frac32 pitch
frac32 Re
frac32 Im
frac32buffer Re
frac32buffer Im
int32.bipolar iterations
frac32.s.map.pitch pitch
int32 limit
bool32.tgl 3oct
bool32.tgl autoadjust
bool32.tgl interp
frac32.s.map re
frac32.s.map im
int32_t re;
int32_t im;
int32_t re_old;
int32_t im_old;
int32_t re_interp;
int32_t im_interp;
int32_t c_re;
int32_t c_im;
int i_number;
int iterations;
int shift;
uint32_t Phase;
uint32_t Phase_old;
re = 0;
im = 0;
re_old = 0;
im_old = 0;
re_interp = 0;
im_interp = 0;
c_re = 0;
c_im = 0;
Phase = 0;
Phase_old = 0;
shift = 0;
i_number = 1;
iterations = 1;
c_re = param_re + inlet_Re >> 5;
c_im = param_im + inlet_Im >> 5;
uint32_t freq;
MTOFEXTENDED(param_pitch + inlet_pitch - (param_3oct * 36 << 21), freq);
if (param_autoadjust)
freq *= iterations;
int limit = param_limit;
outlet_iterations = iterations;
shift = 30 - limit;
Phase += (freq >> 0); // this phasor is used as a counter, when it resets a new
// iteration is calculated.
if (Phase < Phase_old) // if the phasor has reset -> calculate a new iteration
{
if (re_old > (1 << limit) || re_old < -(1 << limit) ||
im_old > (1 << limit) ||
im_old < -(1 << limit)) // reset to z'=(0,0) if the current z has exceded
// the limit size
{
re = 0;
im = 0;
iterations = i_number;
i_number = 1;
} else // iterate z' = z^2 + c if the current z is smaller than the limit size
{
re = ___SMMUL(re_old << 6, re_old << 6) -
___SMMUL(im_old << 6, im_old << 6) + c_re;
im = c_im + (___SMMUL(re_old << 6, im_old << 6) << 1);
i_number += 1;
}
re_interp = re_old; // these two are for the interpolation (basically it keeps
// track of the old value outside the iteration cycle)
im_interp = im_old;
re_old = re;
im_old = im;
}
Phase_old = Phase; // this is needed for the "if () then () " above
if (!param_interp) // output w/o interpolation
{
outlet_Re = (re << shift) >> 4;
outlet_Im = (im << shift) >> 4;
} else // output with interpolation, i need some help here!
{
int32_t phase_t =
Phase >> 4; // make the phase variable signed int (so i can use it inside
// SMMUL) - Also, i'm making it smaller
int32_t temp = (re >> 2) - (re_interp >> 2);
outlet_Re = ((___SMMUL(temp, phase_t) << 6) + (re_interp) << shift) >> 4;
temp = (im >> 2) - (im_interp >> 2);
outlet_Im = ((___SMMUL(temp, phase_t) << 6) + (im_interp) << shift) >>
4; // AIUTO PLEASE
}