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.Type
mk_plain :: Rate -> String -> [UGen] -> Int -> Special -> UGenId -> UGen
mk_plain :: Rate -> String -> [UGen] -> Int -> Special -> UGenId -> UGen
mk_plain Rate
r String
nm [UGen]
inp = Maybe ([Sample] -> Sample)
-> [Rate]
-> Either Rate [Int]
-> String
-> [UGen]
-> Maybe [UGen]
-> Int
-> Special
-> UGenId
-> UGen
mkUGen Maybe ([Sample] -> Sample)
forall a. Maybe a
Nothing [Rate]
all_rates (Rate -> Either Rate [Int]
forall a b. a -> Either a b
Left Rate
r) String
nm [UGen]
inp Maybe [UGen]
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 -> String -> UGen
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 -> String -> UGen
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