rsc3/doc/help/ugen/triggers/poll.help.scrbl

72 lines
1.5 KiB
Text
Raw Permalink Normal View History

2022-08-24 13:53:18 +00:00
#lang scribble/manual
@(require (for-label racket))
@title{(poll trig in trigid label)}
2022-08-28 10:27:01 +00:00
2022-08-24 13:53:18 +00:00
Print/query the current output value of a UGen.
trig - a non-positive to positive transition telling poll to return
a value
in - the signal you want to poll
trigid - if greater then 0, a '/tr' message is sent back to the
client (similar to send-trig)
label - a string or symbol to be printed with the polled value
poll returns its in signal (and is therefore transparent).
WARNING: Printing values from the Server in intensive for the
CPU. poll should be used for debugging purposes.
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(define (string->ugen s)
(make-mce
(cons (string-length s)
(map char->integer (string->list s)))))
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(let ((t (impulse kr 2 0))
(i (line kr 0 1 5 remove-synth)))
(audition (poll t i 0 (string->ugen "Test"))))
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(with-sc3
(lambda (fd)
(letrec ((print (lambda (e) (display e) (newline)))
(showing (lambda (f) (lambda () (let ((v (f))) (print v) v))))
(repeat (lambda (f) (if (f) (repeat f) #f))))
(async fd (/notify 1))
(repeat (showing (lambda () (wait fd "/tr"))))
(async fd (/notify 0)))))
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00
multichannel Expansion (Broken...)
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(define (poll* trig in trigId label)
(poll trig in trigId (string->ugen label)))
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(poll* (impulse kr (mce2 10 5) 0)
(line kr 0 (mce2 1 5) (mce2 1 2) do-nothing)
0
"Test")
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(with-sc3 server-status)
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00