diff options
-rw-r--r-- | valve/help-valve.pd | 30 | ||||
-rw-r--r-- | valve/valve.c | 14 |
2 files changed, 8 insertions, 36 deletions
diff --git a/valve/help-valve.pd b/valve/help-valve.pd index 1d7d721..d5c7cef 100644 --- a/valve/help-valve.pd +++ b/valve/help-valve.pd @@ -24,41 +24,11 @@ #X text 175 78 _________; #X msg 240 82 6; #X text 149 98 ______; -#X obj 86 263 print LEFT; -#X obj 174 259 print RIGHT; -#X msg 232 205 set 0; -#X msg 232 145 bang; -#X obj 232 165 delay 2000; -#X msg 232 185 bang; -#X obj 289 203 print ---------------; -#X obj 306 47 t b b; -#X msg 336 71 6; -#X msg 277 70 3; -#X msg 307 25 bang; -#X text 131 64 ^; -#X text 131 66 |; -#X text 131 66 |; -#X text 135 66 ____________________; #X connect 0 0 9 0; #X connect 0 1 10 0; #X connect 1 0 0 0; #X connect 2 0 1 0; #X connect 2 0 8 0; #X connect 8 0 0 1; -#X connect 9 0 25 0; -#X connect 10 0 26 0; #X connect 11 0 0 0; -#X connect 11 0 28 0; #X connect 23 0 0 0; -#X connect 23 0 28 0; -#X connect 27 0 10 0; -#X connect 27 0 9 0; -#X connect 28 0 29 0; -#X connect 29 0 30 0; -#X connect 30 0 27 0; -#X connect 30 0 31 0; -#X connect 32 0 34 0; -#X connect 32 1 33 0; -#X connect 33 0 0 1; -#X connect 34 0 0 0; -#X connect 35 0 32 0; diff --git a/valve/valve.c b/valve/valve.c index 33a1713..5762201 100644 --- a/valve/valve.c +++ b/valve/valve.c @@ -1,7 +1,10 @@ /* takes a map like 0 1 3 4 7 and a route. if the route and the input are */ /* non-zero in the map, then the route is output from the object */ #include "m_pd.h" -//#include <math.h> +#include <math.h> +#include <string.h> +#define MAXENTRIES 512 +#define LASTENTRY 511 static t_class *valve_class; @@ -13,7 +16,7 @@ typedef struct _valve int bufsize; t_float input, router, max; - t_outlet *routed, *rerouted; + t_outlet *routed, *notrouted; int flush; } t_valve; @@ -45,16 +48,15 @@ void valve_float(t_valve *x, t_floatarg fin) argb = (int)testb; if(arga && argb) { - outlet_float(x->rerouted, x->input); outlet_float(x->routed, x->router); } else if (!argb) { - outlet_float(x->rerouted, 0); + outlet_float(x->notrouted, argb); } else if (!arga && argb) { - outlet_float(x->rerouted, 0); + outlet_float(x->notrouted, arga); } } } @@ -99,7 +101,7 @@ void *valve_new(t_floatarg f) floatinlet_new(&x->x_obj, &x->router); x->routed = outlet_new(&x->x_obj, &s_float); - x->rerouted = outlet_new(&x->x_obj, &s_float); + x->notrouted = outlet_new(&x->x_obj, &s_float); return (void *)x; } |