-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.lisp
More file actions
27 lines (23 loc) · 921 Bytes
/
utils.lisp
File metadata and controls
27 lines (23 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
(in-package :sc-plug)
(defun check-rates (&key audio control)
(let ((audio-inputs (mapcar #'alexandria:ensure-list audio))
(control-inputs (mapcar #'alexandria:ensure-list control)))
(flet ((check (node inputs)
(loop for valid in inputs
for node-input in (cl-collider::inputs node)
always (find node-input valid))))
(lambda (ugen)
(if (eq (cl-collider::rate ugen) :audio)
(check ugen audio-inputs)
(check ugen control-inputs))))))
(defun ctrl-to-audio (input)
(if (eq (cl-collider::rate input) :audio)
input
(k2a.ar input)))
(defun convert-os (oversample)
(cond ((null oversample ) 0)
((eq :x2 oversample) 1)
((eq :x4 oversample) 2)
((eq :x8 oversample) 3)
((eq :x16 oversample) 4)
(t (error "Either set oversample to nil, or use 'x2, 'x4, 'x8, or 'x16"))))