aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2015-02-08 20:16:52 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2015-02-08 20:16:52 +0000
commit0fffeaff6d8af421b67f43e6ac93b00eac378c70 (patch)
tree1d5e9080a6534107183262ba300a0cbf4c1935e0
parentf8a8b079a864e7094e8eee5d89bc1f72fc474c4d (diff)
make [z~ 0] delay by 0 samples
but keep the behaviour of [z~] to delay by 1 sample svn path=/trunk/externals/zexy/; revision=17424
-rw-r--r--src/z~.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/z~.c b/src/z~.c
index 1bf3435..9f32696 100644
--- a/src/z~.c
+++ b/src/z~.c
@@ -87,13 +87,29 @@ static void zNdelay_dsp(t_zNdelay *x, t_signal **sp)
dsp_add(zN_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, sp[0]->s_n);
}
-static void *zNdelay_new(t_floatarg f)
+static void *zNdelay_new(t_symbol*s, int argc, t_atom*argv)
{
- t_zNdelay *x = (t_zNdelay *)pd_new(zNdelay_class);
- int i = f;
+ t_zNdelay *x = 0;
+ int i = 0;
t_sample *b;
- if (i<=0) i=1;
+ switch (argc) {
+ case 0:
+ i=1;
+ break;
+ case 1:
+ if (argv->a_type == A_FLOAT) {
+ i=atom_getint(argv);
+ break;
+ }
+ default:
+ error("Bad arguments for [z~]: must be nought or initial delay [in samples]");
+ return 0;
+ }
+
+ x=(t_zNdelay *)pd_new(zNdelay_class);
+
+ if (i<=0) i=0;
i++;
x->bufsize = i;
@@ -125,7 +141,7 @@ static void zdel_helper(void)
void z_tilde_setup(void)
{
zNdelay_class = class_new(gensym("z~"), (t_newmethod)zNdelay_new, (t_method)zNdelay_free,
- sizeof(t_zNdelay), 0, A_DEFFLOAT, 0);
+ sizeof(t_zNdelay), 0, A_GIMME, 0);
class_addmethod(zNdelay_class, nullfn, gensym("signal"), 0);
class_addmethod(zNdelay_class, (t_method)zNdelay_dsp, gensym("dsp"), 0);