[fluxus] every-frame functions

nik gaffney nik at fo.am
Wed Jun 29 06:25:15 PDT 2005


>>I'm not sure I get exactly what you mean, but maybe a better way of
>>doing this would be to do something like
>>
>>(define (osc-repl)
>>    (if (osc-msg "/code") ; if /code message is recieved
>>        (eval-string (osc 0))) ; read the first argument as code
>>    (if (osc-msg "/foo") ; if /foo message is recieved
>>	(do-something-else))
>>    (render-stuff)) ; call other functions
>>
>>(start-osc "88008")
>>(every-frame "(osc-repl)")
>>
>>then you could send a message along the lines of
>>/code "(build-sphere 12 12)"
>>
>>you could send one message for code that is to be evaluated once, and
>>another for code to be evaluated each frame etc etc. 

maybe something like the following could work, in that it provides a way for
 new functions to be evaluated at 'every-frame', without disturbing
functions that allready are. ,.

essentially just shifting the burden error to another palace ;)


(define frame-functions '())

(define (add-frame-fcn str)
  (set! frame-functions
	(cons str frame-functions)))

(define (rem-frame-fcn str)
  (set! frame-functions
	(delete str frame-functions)))

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

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

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

 ,. then register new functions using add-frame-fcn, rather than every-frame.
     (while being careful not to load scripts that call every-frame )

also this works given the name of functions as strings, ie. (add-frame-fcn
"convulse") rather than using something similar to (every-frame
"(convulse)"). is there a particular reason why the function is referenced
this way?+

blip






More information about the Fluxus mailing list