aboutsummaryrefslogtreecommitdiff
path: root/valve/valve.c
diff options
context:
space:
mode:
Diffstat (limited to 'valve/valve.c')
-rw-r--r--valve/valve.c14
1 files changed, 8 insertions, 6 deletions
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;
}