aboutsummaryrefslogtreecommitdiff
path: root/pd/extra/loop~
diff options
context:
space:
mode:
authorMiller Puckette <millerpuckette@users.sourceforge.net>2004-11-06 16:07:34 +0000
committerMiller Puckette <millerpuckette@users.sourceforge.net>2004-11-06 16:07:34 +0000
commit981f641ef44fe4d72dcb0e1248a2f96ba53cee69 (patch)
treed5871a901628db17e12e6204d13b4bdb4b8a07d9 /pd/extra/loop~
parent5b0640e17d6db9e119d657fcadcf52ff317e704d (diff)
0.38 test 9 (mostly bug fixes)
svn path=/trunk/; revision=2226
Diffstat (limited to 'pd/extra/loop~')
-rw-r--r--pd/extra/loop~/loop~.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/pd/extra/loop~/loop~.c b/pd/extra/loop~/loop~.c
index 85588ba8..2f440030 100644
--- a/pd/extra/loop~/loop~.c
+++ b/pd/extra/loop~/loop~.c
@@ -24,61 +24,61 @@ typedef struct _loopctl
} t_loopctl;
static void loopctl_run(t_loopctl *x, float *transposein,
- float *windowin, float *rawout, float *windowout, int n)
+ float *windowin, float *rawout, float *windowout, int n)
{
float window, invwindow;
double phase = x->l_phase;
if (x->l_resync)
{
- window = *windowin;
- if (window < 0)
- {
- if (window > -1)
- window = -1;
- invwindow = -1/window;
- }
- else
- {
- if (window < 1)
- window = 1;
- invwindow = 1/window;
- }
- x->l_resync = 0;
+ window = *windowin;
+ if (window < 0)
+ {
+ if (window > -1)
+ window = -1;
+ invwindow = -1/window;
+ }
+ else
+ {
+ if (window < 1)
+ window = 1;
+ invwindow = 1/window;
+ }
+ x->l_resync = 0;
}
else
{
- window = x->l_window;
- phase = x->l_phase;
- invwindow = x->l_invwindow;
+ window = x->l_window;
+ phase = x->l_phase;
+ invwindow = x->l_invwindow;
}
while (n--)
{
- double phaseinc = invwindow * *transposein++;
- double newphase;
- float nwind = *windowin++;
- if (phaseinc >= 1 || phaseinc < 0)
- phaseinc = 0;
- newphase = phase + phaseinc;
- if (newphase >= 1)
- {
- window = nwind;
- if (window < 0)
- {
- if (window > -1)
- window = -1;
- invwindow = -1/window;
- }
- else
- {
- if (window < 1)
- window = 1;
- invwindow = 1/window;
- }
- newphase -= 1.;
- }
- phase = newphase;
- *rawout++ = (float)phase;
- *windowout++ = window;
+ double phaseinc = invwindow * *transposein++;
+ double newphase;
+ float nwind = *windowin++;
+ if (phaseinc >= 1 || phaseinc < 0)
+ phaseinc = 0;
+ newphase = phase + phaseinc;
+ if (newphase >= 1)
+ {
+ window = nwind;
+ if (window < 0)
+ {
+ if (window > -1)
+ window = -1;
+ invwindow = -1/window;
+ }
+ else
+ {
+ if (window < 1)
+ window = 1;
+ invwindow = 1/window;
+ }
+ newphase -= 1.;
+ }
+ phase = newphase;
+ *rawout++ = (float)phase;
+ *windowout++ = window;
}
x->l_invwindow = invwindow;
x->l_window = window;
@@ -95,7 +95,7 @@ static void loopctl_init(t_loopctl *x)
static void loopctl_set(t_loopctl *x, float val)
{
if (val < 0 || val > 1)
- val = 0;
+ val = 0;
x->l_phase = val;
x->l_resync = 1;
}
@@ -136,8 +136,8 @@ static t_int *loop_perform(t_int *w)
static void loop_dsp(t_loop *x, t_signal **sp)
{
dsp_add(loop_perform, 6,
- &x->x_loopctl, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec,
- sp[0]->s_n);
+ &x->x_loopctl, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec,
+ sp[0]->s_n);
}
static void loop_set(t_loop *x, t_floatarg val)
@@ -153,11 +153,11 @@ static void loop_bang(t_loop *x)
void loop_tilde_setup(void)
{
loop_class = class_new(gensym("loop~"), (t_newmethod)loop_new, 0,
- sizeof(t_loop), 0, 0);
+ sizeof(t_loop), 0, 0);
class_addmethod(loop_class, (t_method)loop_dsp, gensym("dsp"), A_CANT, 0);
CLASS_MAINSIGNALIN(loop_class, t_loop, x_f);
class_addmethod(loop_class, (t_method)loop_set, gensym("set"),
- A_DEFFLOAT, 0);
+ A_DEFFLOAT, 0);
class_addbang(loop_class, loop_bang);
}