diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2005-12-21 10:55:55 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2005-12-21 10:55:55 +0000 |
commit | 1eaecc5ded6201de9722c147a70270234aa611f1 (patch) | |
tree | dd032aad2341afa0ed8c3758d8ff9a7f65dcfa50 /src | |
parent | de59cf2f202a98a30610bfdba024d6bc9b9d02a5 (diff) |
allow creation with no arguments (defaults to 2 repetitions)
svn path=/trunk/externals/zexy/; revision=4272
Diffstat (limited to 'src')
-rw-r--r-- | src/repeat.c | 10 |
1 files 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")); |