module Sound.Sc3.Ugen.Plain where
import Sound.Sc3.Common.Base
import Sound.Sc3.Common.Math.Operator
import Sound.Sc3.Common.Rate
import Sound.Sc3.Ugen.Types
mk_plain :: Rate -> String -> [Ugen] -> Int -> Special -> UgenId -> Ugen
mk_plain :: Rate -> String -> [Ugen] -> Int -> Special -> UgenId -> Ugen
mk_plain Rate
rt String
nm [Ugen]
inp = Maybe ([Sample] -> Sample)
-> [Rate]
-> Either Rate [Int]
-> String
-> [Ugen]
-> Maybe [Ugen]
-> Int
-> Special
-> UgenId
-> Ugen
mkUgen forall a. Maybe a
Nothing [Rate]
all_rates (forall a b. a -> Either a b
Left Rate
rt) String
nm [Ugen]
inp forall a. Maybe a
Nothing
uop :: Case_Rule -> String -> Rate -> Ugen -> Ugen
uop :: Case_Rule -> String -> Rate -> Ugen -> Ugen
uop Case_Rule
cr String
nm Rate
r Ugen
p =
case Case_Rule -> String -> Maybe Int
unaryIndex Case_Rule
cr String
nm of
Just Int
s -> Rate -> String -> [Ugen] -> Int -> Special -> UgenId -> Ugen
mk_plain Rate
r String
"UnaryOpUGen" [Ugen
p] Int
1 (Int -> Special
Special Int
s) UgenId
NoId
Maybe Int
Nothing -> forall a. HasCallStack => String -> a
error String
"uop"
binop :: Case_Rule -> String -> Rate -> Ugen -> Ugen -> Ugen
binop :: Case_Rule -> String -> Rate -> Ugen -> Ugen -> Ugen
binop Case_Rule
cr String
nm Rate
r Ugen
p Ugen
q =
case Case_Rule -> String -> Maybe Int
binaryIndex Case_Rule
cr String
nm of
Just Int
s -> Rate -> String -> [Ugen] -> Int -> Special -> UgenId -> Ugen
mk_plain Rate
r String
"BinaryOpUGen" [Ugen
p,Ugen
q] Int
1 (Int -> Special
Special Int
s) UgenId
NoId
Maybe Int
Nothing -> forall a. HasCallStack => String -> a
error String
"binop"
ugen :: String -> Rate -> [Ugen] -> Int -> Ugen
ugen :: String -> Rate -> [Ugen] -> Int -> Ugen
ugen String
nm Rate
r [Ugen]
i Int
nc = Rate -> String -> [Ugen] -> Int -> Special -> UgenId -> Ugen
mk_plain Rate
r String
nm [Ugen]
i Int
nc (Int -> Special
Special Int
0) UgenId
NoId
nondet :: String -> UgenId -> Rate -> [Ugen] -> Int -> Ugen
nondet :: String -> UgenId -> Rate -> [Ugen] -> Int -> Ugen
nondet String
nm UgenId
z Rate
r [Ugen]
i Int
nc = Rate -> String -> [Ugen] -> Int -> Special -> UgenId -> Ugen
mk_plain Rate
r String
nm [Ugen]
i Int
nc (Int -> Special
Special Int
0) UgenId
z