hsc3-0.15: Haskell SuperCollider

Safe HaskellSafe-Inferred
LanguageHaskell98

Sound.SC3.UGen.Operator

Contents

Description

Enumerations of the unary and binary math unit generators. Names that conflict with existing names have a _ suffix.

Synopsis

Unary

unaryTable :: [(Unary, String)] Source

Table of symbolic names for standard unary operators.

unaryName :: Int -> String Source

Lookup possibly symbolic name for standard unary operators.

unaryIndex :: Case_Rule -> String -> Maybe Int Source

Given name of unary operator derive index.

mapMaybe (unaryIndex True) (words "NEG CUBED") == [0,13]
unaryIndex True "SinOsc" == Nothing

is_unary :: Case_Rule -> String -> Bool Source

isJust of unaryIndex.

map (is_unary True) (words "ABS MIDICPS NEG")
map (is_unary True) (words "- RAND")

Binary

binaryTable :: [(Binary, String)] Source

Table of symbolic names for standard binary operators.

binaryName :: Int -> String Source

Lookup possibly symbolic name for standard binary operators.

map binaryName [1,2,8,12] == ["-","*","<","Min"]

binaryIndex :: Case_Rule -> String -> Maybe Int Source

Given name of binary operator derive index.

mapMaybe (binaryIndex True) (words "* MUL RING1") == [2,2,30]
binaryIndex True "SINOSC" == Nothing

is_binary :: Case_Rule -> String -> Bool Source

isJust of binaryIndex.

map (is_binary True) (words "== > % TRUNC MAX")

Operator

resolve_operator :: Case_Rule -> String -> (String, Maybe Int) Source

Order of lookup: binary then unary.

map (resolve_operator True) (words "+ - ADD SUB NEG")