aboutsummaryrefslogtreecommitdiff
path: root/valve
diff options
context:
space:
mode:
Diffstat (limited to 'valve')
-rw-r--r--valve/help-valve.pd30
-rw-r--r--valve/valve.c14
2 files changed, 36 insertions, 8 deletions
diff --git a/valve/help-valve.pd b/valve/help-valve.pd
index d5c7cef..1d7d721 100644
--- a/valve/help-valve.pd
+++ b/valve/help-valve.pd
@@ -24,11 +24,41 @@
#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 5762201..33a1713 100644
--- a/valve/valve.c
+++ b/valve/valve.c
@@ -1,10 +1,7 @@
/* 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 <string.h>
-#define MAXENTRIES 512
-#define LASTENTRY 511
+//#include <math.h>
static t_class *valve_class;
@@ -16,7 +13,7 @@ typedef struct _valve
int bufsize;
t_float input, router, max;
- t_outlet *routed, *notrouted;
+ t_outlet *routed, *rerouted;
int flush;
} t_valve;
@@ -48,15 +45,16 @@ 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->notrouted, argb);
+ outlet_float(x->rerouted, 0);
}
else if (!arga && argb)
{
- outlet_float(x->notrouted, arga);
+ outlet_float(x->rerouted, 0);
}
}
}
@@ -101,7 +99,7 @@ void *valve_new(t_floatarg f)
floatinlet_new(&x->x_obj, &x->router);
x->routed = outlet_new(&x->x_obj, &s_float);
- x->notrouted = outlet_new(&x->x_obj, &s_float);
+ x->rerouted = outlet_new(&x->x_obj, &s_float);
return (void *)x;
}