From 68b8233382ab3433a6c85b63d765b3cfcb4ee384 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Fri, 16 Oct 2009 21:54:10 +0200 Subject: [PATCH] plugins/puredata/aubioonset~.c: indent --- plugins/puredata/aubioonset~.c | 134 ++++++++++++++++----------------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/plugins/puredata/aubioonset~.c b/plugins/puredata/aubioonset~.c index de2af57c..a191ce60 100644 --- a/plugins/puredata/aubioonset~.c +++ b/plugins/puredata/aubioonset~.c @@ -16,90 +16,90 @@ static t_class *aubioonset_tilde_class; void aubioonset_tilde_setup (void); -typedef struct _aubioonset_tilde +typedef struct _aubioonset_tilde { - t_object x_obj; - t_float threshold; - t_int pos; /*frames%dspblocksize*/ - t_int bufsize; - t_int hopsize; - aubio_onset_t *o; - fvec_t *in; - fvec_t *out; - t_outlet *onsetbang; + t_object x_obj; + t_float threshold; + t_int pos; /*frames%dspblocksize */ + t_int bufsize; + t_int hopsize; + aubio_onset_t *o; + fvec_t *in; + fvec_t *out; + t_outlet *onsetbang; } t_aubioonset_tilde; -static t_int *aubioonset_tilde_perform(t_int *w) +static t_int * +aubioonset_tilde_perform (t_int * w) { - t_aubioonset_tilde *x = (t_aubioonset_tilde *)(w[1]); - t_sample *in = (t_sample *)(w[2]); - int n = (int)(w[3]); - int j; - for (j=0;jin, in[j], 0, x->pos); - /*time to do something */ - if (x->pos == x->hopsize-1) { - /* block loop */ - aubio_onset_do (x->o, x->in, x->out); - if (fvec_read_sample(x->out, 0, 0) > 0.) { - outlet_bang(x->onsetbang); - } - /* end of block loop */ - x->pos = -1; /* so it will be zero next j loop */ - } - x->pos++; - } - return (w+4); + t_aubioonset_tilde *x = (t_aubioonset_tilde *) (w[1]); + t_sample *in = (t_sample *) (w[2]); + int n = (int) (w[3]); + int j; + for (j = 0; j < n; j++) { + /* write input to datanew */ + fvec_write_sample (x->in, in[j], 0, x->pos); + /*time to do something */ + if (x->pos == x->hopsize - 1) { + /* block loop */ + aubio_onset_do (x->o, x->in, x->out); + if (fvec_read_sample (x->out, 0, 0) > 0.) { + outlet_bang (x->onsetbang); + } + /* end of block loop */ + x->pos = -1; /* so it will be zero next j loop */ + } + x->pos++; + } + return (w + 4); } -static void aubioonset_tilde_dsp(t_aubioonset_tilde *x, t_signal **sp) +static void +aubioonset_tilde_dsp (t_aubioonset_tilde * x, t_signal ** sp) { - dsp_add(aubioonset_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); + dsp_add (aubioonset_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); } -static void aubioonset_tilde_debug(t_aubioonset_tilde *x) +static void +aubioonset_tilde_debug (t_aubioonset_tilde * x) { - post("aubioonset~ bufsize:\t%d", x->bufsize); - post("aubioonset~ hopsize:\t%d", x->hopsize); - post("aubioonset~ threshold:\t%f", x->threshold); - post("aubioonset~ audio in:\t%f", x->in->data[0][0]); - post("aubioonset~ onset:\t%f", x->out->data[0][0]); + post ("aubioonset~ bufsize:\t%d", x->bufsize); + post ("aubioonset~ hopsize:\t%d", x->hopsize); + post ("aubioonset~ threshold:\t%f", x->threshold); + post ("aubioonset~ audio in:\t%f", x->in->data[0][0]); + post ("aubioonset~ onset:\t%f", x->out->data[0][0]); } -static void *aubioonset_tilde_new (t_floatarg f) +static void * +aubioonset_tilde_new (t_floatarg f) { - t_aubioonset_tilde *x = - (t_aubioonset_tilde *)pd_new(aubioonset_tilde_class); + t_aubioonset_tilde *x = + (t_aubioonset_tilde *) pd_new (aubioonset_tilde_class); - x->threshold = (f < 1e-5) ? 0.1 : (f > 10.) ? 10. : f; - x->bufsize = 1024; - x->hopsize = x->bufsize / 2; + x->threshold = (f < 1e-5) ? 0.1 : (f > 10.) ? 10. : f; + x->bufsize = 1024; + x->hopsize = x->bufsize / 2; - x->o = new_aubio_onset ("complex", - x->bufsize, x->hopsize, 1, (uint_t)sys_getsr()); - x->in = (fvec_t *)new_fvec(x->hopsize,1); - x->out = (fvec_t *)new_fvec(1,1); + x->o = new_aubio_onset ("complex", + x->bufsize, x->hopsize, 1, (uint_t) sys_getsr ()); + x->in = (fvec_t *) new_fvec (x->hopsize, 1); + x->out = (fvec_t *) new_fvec (1, 1); - floatinlet_new (&x->x_obj, &x->threshold); - x->onsetbang = outlet_new (&x->x_obj, &s_bang); - post(aubioonset_version); - return (void *)x; + floatinlet_new (&x->x_obj, &x->threshold); + x->onsetbang = outlet_new (&x->x_obj, &s_bang); + post (aubioonset_version); + return (void *) x; } -void aubioonset_tilde_setup (void) +void +aubioonset_tilde_setup (void) { - aubioonset_tilde_class = class_new (gensym ("aubioonset~"), - (t_newmethod)aubioonset_tilde_new, - 0, sizeof (t_aubioonset_tilde), - CLASS_DEFAULT, A_DEFFLOAT, 0); - class_addmethod(aubioonset_tilde_class, - (t_method)aubioonset_tilde_dsp, - gensym("dsp"), 0); - class_addmethod(aubioonset_tilde_class, - (t_method)aubioonset_tilde_debug, - gensym("debug"), 0); - CLASS_MAINSIGNALIN(aubioonset_tilde_class, - t_aubioonset_tilde, threshold); + aubioonset_tilde_class = class_new (gensym ("aubioonset~"), + (t_newmethod) aubioonset_tilde_new, + 0, sizeof (t_aubioonset_tilde), CLASS_DEFAULT, A_DEFFLOAT, 0); + class_addmethod (aubioonset_tilde_class, + (t_method) aubioonset_tilde_dsp, gensym ("dsp"), 0); + class_addmethod (aubioonset_tilde_class, + (t_method) aubioonset_tilde_debug, gensym ("debug"), 0); + CLASS_MAINSIGNALIN (aubioonset_tilde_class, t_aubioonset_tilde, threshold); } - -- 2.26.2