From 739a8290a8b05645a2d055aed8e5eb76ba2e24e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Fri, 28 Aug 2015 17:55:26 +0000 Subject: one-true indentation svn path=/trunk/externals/zexy/; revision=17537 --- src/blockmirror~.c | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) (limited to 'src/blockmirror~.c') diff --git a/src/blockmirror~.c b/src/blockmirror~.c index c796d7b..63a0c12 100644 --- a/src/blockmirror~.c +++ b/src/blockmirror~.c @@ -7,12 +7,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ @@ -28,8 +28,7 @@ static t_class *blockmirror_class; -typedef struct _blockmirror -{ +typedef struct _blockmirror { t_object x_obj; int doit; int blocksize; @@ -48,24 +47,34 @@ static t_int *blockmirror_perform(t_int *w) t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); if (x->doit) { - if (in==out){ + if (in==out) { int N=n; t_sample *dummy=x->blockbuffer; - while(n--)*dummy++=*in++; + while(n--) { + *dummy++=*in++; + } dummy--; - while(N--)*out++=*dummy--; + while(N--) { + *out++=*dummy--; + } } else { in+=n-1; - while(n--)*out++=*in--; + while(n--) { + *out++=*in--; + } + } + } else while (n--) { + *out++ = *in++; } - } else while (n--) *out++ = *in++; return (w+5); } static void blockmirror_dsp(t_blockmirror *x, t_signal **sp) { - if (x->blocksizes_n){ - if(x->blockbuffer)freebytes(x->blockbuffer, sizeof(*x->blockbuffer)*x->blocksize); + if (x->blocksizes_n) { + if(x->blockbuffer) { + freebytes(x->blockbuffer, sizeof(*x->blockbuffer)*x->blocksize); + } x->blocksize = sp[0]->s_n; x->blockbuffer = getbytes(sizeof(*x->blockbuffer)*x->blocksize); } @@ -81,8 +90,9 @@ static void blockmirror_helper(t_blockmirror*x) } static void blockmirror_free(t_blockmirror*x) { - if(x->blockbuffer) + if(x->blockbuffer) { freebytes(x->blockbuffer, sizeof(*x->blockbuffer)*x->blocksize); + } x->blockbuffer=0; } static void *blockmirror_new(void) @@ -96,14 +106,17 @@ static void *blockmirror_new(void) void blockmirror_tilde_setup(void) { - blockmirror_class = class_new(gensym("blockmirror~"), (t_newmethod)blockmirror_new, + blockmirror_class = class_new(gensym("blockmirror~"), + (t_newmethod)blockmirror_new, (t_method)blockmirror_free, sizeof(t_blockmirror), 0, A_NULL); class_addmethod(blockmirror_class, nullfn, gensym("signal"), 0); - class_addmethod(blockmirror_class, (t_method)blockmirror_dsp, gensym("dsp"), 0); - + class_addmethod(blockmirror_class, (t_method)blockmirror_dsp, + gensym("dsp"), 0); + class_addfloat(blockmirror_class, blockmirror_float); - - class_addmethod(blockmirror_class, (t_method)blockmirror_helper, gensym("help"), 0); + + class_addmethod(blockmirror_class, (t_method)blockmirror_helper, + gensym("help"), 0); zexy_register("blockmirror~"); } -- cgit v1.2.1