From 1eaecc5ded6201de9722c147a70270234aa611f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 21 Dec 2005 10:55:55 +0000 Subject: allow creation with no arguments (defaults to 2 repetitions) svn path=/trunk/externals/zexy/; revision=4272 --- src/repeat.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/repeat.c b/src/repeat.c index 9202e47..8eb4b3e 100644 --- a/src/repeat.c +++ b/src/repeat.c @@ -40,10 +40,14 @@ static void repeat_anything(t_repeat *x, t_symbol *s, int argc, t_atom *argv) while(i--)outlet_anything(x->x_obj.ob_outlet, s, argc, argv); } -static void *repeat_new(t_float f) +static void *repeat_new(t_symbol*s, int argc, t_atom*argv) { t_repeat *x = (t_repeat *)pd_new(repeat_class); - x->fcount = f; + if(argc){ + if(A_FLOAT==argv->a_type) + x->fcount = atom_getfloat(argv); + else return 0; + } else x->fcount=2; floatinlet_new(&x->x_obj, &x->fcount); outlet_new(&x->x_obj, 0); return (x); @@ -52,7 +56,7 @@ static void *repeat_new(t_float f) void repeat_setup(void) { repeat_class = class_new(gensym("repeat"), (t_newmethod)repeat_new, - 0, sizeof(t_repeat), 0, A_FLOAT, 0); + 0, sizeof(t_repeat), 0, A_GIMME, 0); class_addanything(repeat_class, repeat_anything); class_sethelpsymbol(repeat_class, gensym("zexy/repeat")); -- cgit v1.2.1