aboutsummaryrefslogtreecommitdiff
path: root/src/multiplex_tilde.c
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-05-17 16:50:28 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-05-17 16:50:28 +0000
commit6b378329aa20ec2caa3f06968c2ac71d41dca7f9 (patch)
tree849bbfb62e3b5842252a3920e3a0b0bdf3617ac8 /src/multiplex_tilde.c
parentc3a32b31057a7f805382154403ddb6d68424a6dd (diff)
renamed *_tilde.c-files to *~.c
svn path=/trunk/externals/zexy/; revision=2998
Diffstat (limited to 'src/multiplex_tilde.c')
-rw-r--r--src/multiplex_tilde.c112
1 files changed, 0 insertions, 112 deletions
diff --git a/src/multiplex_tilde.c b/src/multiplex_tilde.c
deleted file mode 100644
index be141cd..0000000
--- a/src/multiplex_tilde.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/******************************************************
- * zexy - implementation file
- *
- * copyleft (c) IOhannes m zmölnig
- *
- * 1999:forum::für::umläute:2004
- *
- * institute of electronic music and acoustics (iem)
- *
- ******************************************************
- *
- * license: GNU General Public License v.2
- *
- ******************************************************/
-
-#include "zexy.h"
-
-
-/* ------------------------------------------------------------------------------ */
-
-/* mux~ : multiplex a specified signal to the output */
-
-static t_class *mux_class;
-
-typedef struct _mux {
- t_object x_obj;
-
- int input;
-
- int n_in;
- t_float **in;
-} t_mux;
-
-static void mux_input(t_mux *x, t_floatarg f)
-{
- if ((f>=0)&&(f<x->n_in)){
- x->input=f;
- } else
- error("multiplex: %d is channel out of range (0..%d)", (int)f, x->n_in);
-
-}
-
-static t_int *mux_perform(t_int *w)
-{
- t_mux *x = (t_mux *)(w[1]);
- t_float *out = (t_float *)(w[2]);
- int n = (int)(w[3]);
-
- t_float *in = x->in[x->input];
-
- while(n--)*out++=*in++;
-
- return (w+4);
-}
-
-static void mux_dsp(t_mux *x, t_signal **sp)
-{
- int n = 0;
- t_float **dummy=x->in;
-
- for(n=0;n<x->n_in;n++)*dummy++=sp[n]->s_vec;
-
- dsp_add(mux_perform, 3, x, sp[n]->s_vec, sp[0]->s_n);
-}
-
-static void mux_helper(void)
-{
- post("\n%c mux~\t:: multiplex a one of various signals to one outlet", HEARTSYMBOL);
- post("<#out>\t : the inlet-number (counting from 0) witch is routed to the outlet"
- "'help'\t : view this");
- post("creation : \"mux~ [arg1 [arg2...]]\"\t: the number of arguments equals the number of inlets\n");
-}
-
-static void mux_free(t_mux *x)
-{
- freebytes(x->in, x->n_in * sizeof(t_float *));
-}
-
-static void *mux_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_mux *x = (t_mux *)pd_new(mux_class);
- int i;
-
- if (!argc)argc=2;
- x->n_in=argc;
- x->input=0;
-
- argc--;
- while(argc--)inlet_new(&x->x_obj,&x->x_obj.ob_pd,&s_signal,&s_signal);
-
- x->in = (t_float **)getbytes(x->n_in * sizeof(t_float *));
- i=x->n_in;
- while(i--)x->in[i]=0;
-
- outlet_new(&x->x_obj, gensym("signal"));
-
- return (x);
-}
-
-void multiplex_tilde_setup(void)
-{
- mux_class = class_new(gensym("multiplex~"), (t_newmethod)mux_new, (t_method)mux_free, sizeof(t_mux), 0, A_GIMME, 0);
- class_addcreator((t_newmethod)mux_new, gensym("mux~"), A_GIMME, 0);
-
- class_addfloat(mux_class, mux_input);
- class_addmethod(mux_class, (t_method)mux_dsp, gensym("dsp"), 0);
- class_addmethod(mux_class, nullfn, gensym("signal"), 0);
-
- class_addmethod(mux_class, (t_method)mux_helper, gensym("help"), 0);
- class_sethelpsymbol(mux_class, gensym("zexy/multiplex~"));
- zexy_register("multiplex~");
-}