[fluxus] questions about fluxus

nik gaffney nik at fo.am
Mon Jan 23 02:28:00 PST 2006


> Nik's been using a technique like this, but it would be useful to have it
> written up in the docs (hint hint ;)) as I think it's quite a common
> requirement.

im a bit busy at the moment, but i am planing to add a few paragraphs covering
this sort of thing. there is also the explanation of using fluxus from emacs
that i promised to write up.. .,.  .

but isnt code the best documentation?! ;)


;;;;;;; ; ;
;;
;; Interface for setting functions to be evaluated each frame.
;;
;; registers (mevery-frame) as a frame handler, so other code should
;; avoid using (every-frame ...)
;;
;; a frame-function can be added as a string ie. "(build-cube)" which
;; could also include a quoted sexp for a function to called with args
;; ie. "(build-sphere 12 12)"
;;
;;;; ; ;

(define frame-functions '())

(define (add-frame-fcn str)
  (if (not (member str frame-functions))
      (set! frame-functions
	    (cons str frame-functions)))
  (display-frame-functions)
  (every-frame "(mevery-frame)"))

(define (remove-frame-fcn str)
  (set! frame-functions
	(delete str frame-functions))
  (display-frame-functions))

(define (clear-frame-fcn)
    (set! frame-functions '()))

(define  (display-frame-functions)
  (display "current frame-functions: ")
  (display frame-functions)
  (newline))

(define (mevery-frame)
    (map eval-string frame-functions))

(every-frame "(mevery-frame)")


;;; ;  ;;  ; ;;;
;;
;; osc evaluator
;;   test with > sendOSC -h 127.0.0.1 88008 /code '(build-sphere 12 12)'
;;
;;;;; ;;   ; ;

(define (osc-repl)
  (cond ((osc-msg "/code")
	 (eval-string (osc-peek)))
	((osc-msg "/ping")
	 (begin (display "ping... ")
		(newline)))))

(osc-source "88008")

(add-frame-fcn "(osc-repl)")



More information about the Fluxus mailing list