diff options
author | daniel aschauer <aschix@users.sourceforge.net> | 2009-01-09 17:23:55 +0000 |
---|---|---|
committer | daniel aschauer <aschix@users.sourceforge.net> | 2009-01-09 17:23:55 +0000 |
commit | 420ada2dde4af8d71bc1d9c6988311961cf47f1b (patch) | |
tree | 874d3bda95a9dbc113a1bd24dfdf1d57ba8dcb6a /distribute.c |
svn path=/trunk/externals/algocomp/; revision=10494svn2git-root
Diffstat (limited to 'distribute.c')
-rwxr-xr-x | distribute.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/distribute.c b/distribute.c new file mode 100755 index 0000000..d39d16a --- /dev/null +++ b/distribute.c @@ -0,0 +1,35 @@ +#include "m_pd.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +static t_class *distribute_class; + +typedef struct _distribute { + t_object x_obj; + t_int counter; + t_int max; + t_outlet *out[128];//,*r_out,*n_out; +} t_distribute; + +void distribute_float(t_distribute *x,t_float in) +{ +outlet_float(x->out[x->counter],in); +x->counter++; +if (x->counter == x->max) +x->counter = 0; +//x->out[x->counter] = in; +} + +void *distribute_new(t_floatarg f1) +{ + int i; + t_distribute *x = (t_distribute *)pd_new(distribute_class); + x->counter = 0; + if ((f1>0) && (f1<128)) + x->max = (t_int) f1; + else x->max = 8; + for (i=0;i<x->max;i++) + x->out[i] = outlet_new(&x->x_obj,&s_float); + return (void *)x; +} |