rsc3/doc/help/ugen/controls/wrap-index.help.scrbl

27 lines
580 B
Text
Raw Permalink Normal View History

2022-08-24 13:53:18 +00:00
#lang scribble/manual
@(require (for-label racket))
@title{(wrap-index bufnum in)}
2022-08-28 10:27:01 +00:00
2022-08-24 13:53:18 +00:00
index into a table with a signal.
The input signal value is truncated to an integer value and used as
an index into the table. out of range index values are wrapped
cyclically to the valid range.
bufnum - index of the buffer
in - the input signal.
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(with-sc3
(lambda (fd)
(async fd (b-alloc 0 6 1))
(send fd (b-setn1 0 0 (list 200 300 400 500 600 800)))
(let ((f (wrap-index 0 (mouse-x kr 0 18 0 0.1))))
(play fd (out 0 (mul (sin-osc ar f 0) 0.5))))))
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00