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/blockswap~.c | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) (limited to 'src/blockswap~.c') diff --git a/src/blockswap~.c b/src/blockswap~.c index deb9ce2..d59f312 100644 --- a/src/blockswap~.c +++ b/src/blockswap~.c @@ -1,4 +1,4 @@ -/* +/* * blockswap~: swaps a signalblock around it's center * * (c) 1999-2011 IOhannes m zmölnig, forum::für::umläute, institute of electronic music and acoustics (iem) @@ -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 . */ @@ -27,8 +27,7 @@ static t_class *blockswap_class; -typedef struct _blockswap -{ +typedef struct _blockswap { t_object x_obj; int doit; int blocksize; @@ -50,20 +49,30 @@ static t_int *blockswap_perform(t_int *w) if (x->doit) { int n=N2; t_sample *dummy=x->blockbuffer; - while(n--)*dummy++=*in++; + while(n--) { + *dummy++=*in++; + } n=N-N2; - while(n--)*out++=*in++; + while(n--) { + *out++=*in++; + } dummy=x->blockbuffer; - n=N2; - while(n--)*out++=*dummy++; - } else while (N--) *out++=*in++; + n=N2; + while(n--) { + *out++=*dummy++; + } + } else while (N--) { + *out++=*in++; + } return (w+5); } static void blockswap_dsp(t_blockswap *x, t_signal **sp) { - if (x->blocksize*2s_n){ - if(x->blockbuffer)freebytes(x->blockbuffer, sizeof(*x->blockbuffer)*x->blocksize); + if (x->blocksize*2s_n) { + if(x->blockbuffer) { + freebytes(x->blockbuffer, sizeof(*x->blockbuffer)*x->blocksize); + } x->blocksize = sp[0]->s_n/2; x->blockbuffer = getbytes(sizeof(*x->blockbuffer)*x->blocksize); } @@ -80,7 +89,7 @@ static void blockswap_helper(t_blockswap *x) static void blockswap_free(t_blockswap *x) { - if(x->blockbuffer){ + if(x->blockbuffer) { freebytes(x->blockbuffer, sizeof(*x->blockbuffer)*x->blocksize); } x->blockbuffer=0; @@ -97,13 +106,16 @@ static void *blockswap_new(void) void blockswap_tilde_setup(void) { - blockswap_class = class_new(gensym("blockswap~"), (t_newmethod)blockswap_new, (t_method)blockswap_free, + blockswap_class = class_new(gensym("blockswap~"), + (t_newmethod)blockswap_new, (t_method)blockswap_free, sizeof(t_blockswap), 0, A_NULL); class_addmethod(blockswap_class, nullfn, gensym("signal"), 0); - class_addmethod(blockswap_class, (t_method)blockswap_dsp, gensym("dsp"), 0); - + class_addmethod(blockswap_class, (t_method)blockswap_dsp, gensym("dsp"), + 0); + class_addfloat(blockswap_class, blockswap_float); - - class_addmethod(blockswap_class, (t_method)blockswap_helper, gensym("help"), 0); + + class_addmethod(blockswap_class, (t_method)blockswap_helper, + gensym("help"), 0); zexy_register("blockswap~"); } -- cgit v1.2.1