more reorganizing of train's code
@@ -47,18 +47,14 @@ static t_int *train_perform(t_int *w)
while (nblock--)
{
period = *in1++;
-
phase_step = period > 0 ? rcpksr / period : 0.5;
-
if (phase_step > 0.5)
phase_step = 0.5; // smallest period corresponds to nyquist
-
width = *in2++;
if (width < 0.)
width = 0.;
if (width > 1.)
width = 1.;
-
phase_offset = *in3++;
if (phase_offset < 0.)
phase_offset = 0.;
@@ -66,12 +62,8 @@ static t_int *train_perform(t_int *w)
phase_offset = 1.;
wrap_low = (double)phase_offset;
wrap_high = (double)phase_offset + 1.;
-
- {
wrapped_phase = (phase >= wrap_high) ? (wrap_low + phase - wrap_high) : phase; // wrapped phase
-
next_phase = wrapped_phase + phase_step; // next phase (unwrapped)
-
if (phase >= wrap_high)
{
*out++ = 1.; // 1st always 1
@@ -81,8 +73,7 @@ static t_int *train_perform(t_int *w)
*out++ = 0.;
else if(next_phase >= wrap_high)
*out++ = 0.; // last always 0
- else *out++ = phase < width + phase_offset; // check
- }
+ else *out++ = phase < (width + phase_offset); // check
phase = next_phase;
}
x->x_phase = phase;
