aboutsummaryrefslogtreecommitdiff
path: root/stochastic.c
diff options
context:
space:
mode:
authordaniel aschauer <aschix@users.sourceforge.net>2009-01-09 17:23:55 +0000
committerdaniel aschauer <aschix@users.sourceforge.net>2009-01-09 17:23:55 +0000
commit420ada2dde4af8d71bc1d9c6988311961cf47f1b (patch)
tree874d3bda95a9dbc113a1bd24dfdf1d57ba8dcb6a /stochastic.c
svn path=/trunk/externals/algocomp/; revision=10494svn2git-root
Diffstat (limited to 'stochastic.c')
-rwxr-xr-xstochastic.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/stochastic.c b/stochastic.c
new file mode 100755
index 0000000..47b0c8a
--- /dev/null
+++ b/stochastic.c
@@ -0,0 +1,29 @@
+//TODO Replace with classes fot stochastic
+
+#include "m_pd.h"
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+typedef struct _logistic {
+ t_object x_obj;
+ t_float x;
+ t_float a;
+ t_outlet *note_out;
+} t_logistic;
+
+void logistic_bang(t_logistic *x)
+{
+outlet_float(x->note_out, x->x);
+x->x = x->a*x->x*(1-x->x);
+}
+
+void *logistic_new(t_floatarg f)
+{
+ t_logistic *x = (t_logistic *)pd_new(logistic_class);
+ x->a = f;
+ x->x = 0.5;
+ x->note_out = outlet_new(&x->x_obj,&s_float);
+ floatinlet_new(&x->x_obj, &x->a);
+ return (void *)x;
+} \ No newline at end of file