;; [string] (define unary-operator-names (list "-" "not" "is-nil" "not-nil" "bit-not" "abs" "as-float" "as-int" "ceil" "floor" "frac" "sign" "squared" "cubed" "sqrt" "exp" "recip" "midi-cps" "cps-midi" "midi-ratio" "ratio-midi" "db-amp" "amp-db" "oct-cps" "cps-oct" "log" "log2" "log10" "sin" "cos" "tan" "arc-sin" "arc-cos" "arc-tan" "sin-h" "cos-h" "tan-h" "_rand" "rand2" "_lin-rand" "bilinrand" "sum3rand" "distort" "soft-clip" "coin" "digit-value" "silence" "thru" "rect-window" "han-window" "welch-window" "tri-window" "_ramp" "scurve")) ;; int -> string (define unary-operator-name (lambda (i) (list-ref unary-operator-names i))) ;; [string] (define binary-operator-names (list "+" "-" "*" "idiv" "/" "%" "==" "!=" "<" ">" "<=" ">=" "min" "max" "bit-and" "bit-or" "bit-xor" "lcm" "gcd" "round" "round-up" "trunc" "atan2" "hypot" "hypotx" "pow" "shift-left" "shift-right" "unsigned-shift" "fill" "ring1" "ring2" "ring3" "ring4" "dif-sqr" "sum-sqr" "sqr-sum" "sqr-dif" "abs-dif" "thresh" "am-clip" "scale-neg" "clip2" "excess" "fold2" "wrap2" "first-arg" "rand-range" "exp-rand-range")) ;; int -> string (define binary-operator-name (lambda (i) (list-ref binary-operator-names i))) ;; ugen -> maybe string (define operator-name (lambda (u) (cond ((string=? (ugen-name u) "BinaryOpUGen") (binary-operator-name (ugen-special u))) ((string=? (ugen-name u) "UnaryOpUGen") (unary-operator-name (ugen-special u))) (else #f))))