diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2015-08-28 17:55:26 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2015-08-28 17:55:26 +0000 |
commit | 739a8290a8b05645a2d055aed8e5eb76ba2e24e6 (patch) | |
tree | 13713efb9e01a6f2912ce4fe0a12af4869a7593b /src/blockmirror~.c | |
parent | 863ac0a263247d43d48c06ed942ddd470f811507 (diff) |
one-true indentation
svn path=/trunk/externals/zexy/; revision=17537
Diffstat (limited to 'src/blockmirror~.c')
-rw-r--r-- | src/blockmirror~.c | 47 |
1 files changed, 30 insertions, 17 deletions
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 <http://www.gnu.org/licenses/>. */ @@ -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->blocksize<sp[0]->s_n){ - if(x->blockbuffer)freebytes(x->blockbuffer, sizeof(*x->blockbuffer)*x->blocksize); + if (x->blocksize<sp[0]->s_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~"); } |