aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil S. Matheussen <ksvalast@users.sourceforge.net>2004-01-16 15:07:14 +0000
committerKjetil S. Matheussen <ksvalast@users.sourceforge.net>2004-01-16 15:07:14 +0000
commitabab98e79999d4cb1fc9bad5ce5dff36a5ef9412 (patch)
tree2b29abcef42915a9ec947b0b9c5823f5efa8e0e8
parent3a3bc5212c4956426f967d3dacc076905cac14d6 (diff)
An inlet can receive anything by using any as type
svn path=/trunk/externals/k_guile/; revision=1268
-rw-r--r--any.scm5
-rw-r--r--help-k_guile.pd17
-rw-r--r--local.scm11
3 files changed, 31 insertions, 2 deletions
diff --git a/any.scm b/any.scm
new file mode 100644
index 0000000..bf26191
--- /dev/null
+++ b/any.scm
@@ -0,0 +1,5 @@
+
+
+(pd-inlet 0 'any
+ (lambda x
+ (pd-display "Got " x " to inlet 0")))
diff --git a/help-k_guile.pd b/help-k_guile.pd
index c190314..6e7614c 100644
--- a/help-k_guile.pd
+++ b/help-k_guile.pd
@@ -1,4 +1,4 @@
-#N canvas 372 11 707 547 10;
+#N canvas 481 303 707 547 10;
#X obj 101 135 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10
-262144 -1 -1 0 256;
#X obj 101 162 k_guile add.scm;
@@ -43,6 +43,15 @@ outlets by sending reload .;
#X msg 409 95 we 3 2;
#X msg 512 286 eval (newline);
#X msg 512 309 eval (display(environ));
+#X obj 65 487 k_guile any.scm;
+#X msg 25 448 reload;
+#X obj 193 448 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10
+-262144 -1 -1 0 256;
+#X msg 149 446 gakk;
+#X obj 261 446 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X msg 289 447 list 2 3 4;
+#X msg 90 446 we 3 2;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 3 0 1 1;
@@ -66,3 +75,9 @@ outlets by sending reload .;
#X connect 29 0 7 0;
#X connect 30 0 24 0;
#X connect 31 0 24 0;
+#X connect 33 0 32 0;
+#X connect 34 0 32 0;
+#X connect 35 0 32 0;
+#X connect 36 0 32 0;
+#X connect 37 0 32 0;
+#X connect 38 0 32 0;
diff --git a/local.scm b/local.scm
index 500f78b..31e107b 100644
--- a/local.scm
+++ b/local.scm
@@ -56,6 +56,7 @@
;;
;;
(define pd-inlet-vector (make-vector 1 '()))
+(define pd-inlet-anyvector (make-vector 1 '()))
(define (pd-set-inlet-func)
(pd-c-set-inlet-func pd-instance
@@ -64,6 +65,11 @@
(let ((inlet-func (assq symbol
(vector-ref pd-inlet-vector
inlet-num))))
+ (if (not inlet-func)
+ (begin
+ (set! inlet-func (assq 'any
+ (vector-ref pd-inlet-vector inlet-num)))
+ (set! args (cons symbol args))))
(if inlet-func
(apply (cadr inlet-func) args)
(pd-display "No function defined for handling \'" symbol " to inlet " inlet-num))))))
@@ -73,7 +79,10 @@
(pd-display "Wrong argument to pd-inlet: " func " is not a procedure")
(if (and (pd-check-number inlet-num "pd-inlet")
(pd-legalinlet inlet-num))
- (let ((inlet-funcs (vector-ref pd-inlet-vector inlet-num)))
+ (let ((inlet-funcs (vector-ref (if (eq? symbol 'any)
+ pd-inlet-anyvector
+ pd-inlet-vector)
+ inlet-num)))
(vector-set! pd-inlet-vector
inlet-num
(cons (list symbol func)