module Sound.SC3.UGen.Bindings.HW.Construct where
import Sound.SC3.Common.Rate
import Sound.SC3.UGen.Type
mk_osc :: [Rate] -> UGenId -> Rate -> String -> [UGen] -> Int -> UGen
mk_osc :: [Rate] -> UGenId -> Rate -> String -> [UGen] -> Int -> UGen
mk_osc [Rate]
rs UGenId
z Rate
r String
c [UGen]
i Int
o =
if Rate
r Rate -> [Rate] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Rate]
rs
then 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]
rs (Rate -> Either Rate [Int]
forall a b. a -> Either a b
Left Rate
r) String
c [UGen]
i Maybe [UGen]
forall a. Maybe a
Nothing Int
o (Int -> Special
Special Int
0) UGenId
z
else String -> UGen
forall a. HasCallStack => String -> a
error (String
"mk_osc: rate restricted: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ (Rate, [Rate], String) -> String
forall a. Show a => a -> String
show (Rate
r, [Rate]
rs, String
c))
mkOsc :: Rate -> String -> [UGen] -> Int -> UGen
mkOsc :: Rate -> String -> [UGen] -> Int -> UGen
mkOsc = [Rate] -> UGenId -> Rate -> String -> [UGen] -> Int -> UGen
mk_osc [Rate]
all_rates UGenId
no_id
mkOscR :: [Rate] -> Rate -> String -> [UGen] -> Int -> UGen
mkOscR :: [Rate] -> Rate -> String -> [UGen] -> Int -> UGen
mkOscR [Rate]
rs = [Rate] -> UGenId -> Rate -> String -> [UGen] -> Int -> UGen
mk_osc [Rate]
rs UGenId
no_id
mkOscIdR :: [Rate] -> UGenId -> Rate -> String -> [UGen] -> Int -> UGen
mkOscIdR :: [Rate] -> UGenId -> Rate -> String -> [UGen] -> Int -> UGen
mkOscIdR = [Rate] -> UGenId -> Rate -> String -> [UGen] -> Int -> UGen
mk_osc
mkOscId :: UGenId -> Rate -> String -> [UGen] -> Int -> UGen
mkOscId :: UGenId -> Rate -> String -> [UGen] -> Int -> UGen
mkOscId = [Rate] -> UGenId -> Rate -> String -> [UGen] -> Int -> UGen
mk_osc [Rate]
all_rates
mk_osc_mce :: UGenId -> Rate -> String -> [UGen] -> UGen -> Int -> UGen
mk_osc_mce :: UGenId -> Rate -> String -> [UGen] -> UGen -> Int -> UGen
mk_osc_mce UGenId
z Rate
r String
c [UGen]
i UGen
j =
let i' :: [UGen]
i' = [UGen]
i [UGen] -> [UGen] -> [UGen]
forall a. [a] -> [a] -> [a]
++ UGen -> [UGen]
mceChannels UGen
j
in [Rate] -> UGenId -> Rate -> String -> [UGen] -> Int -> UGen
mk_osc [Rate]
all_rates UGenId
z Rate
r String
c [UGen]
i'
mkOscMCE :: Rate -> String -> [UGen] -> UGen -> Int -> UGen
mkOscMCE :: Rate -> String -> [UGen] -> UGen -> Int -> UGen
mkOscMCE = UGenId -> Rate -> String -> [UGen] -> UGen -> Int -> UGen
mk_osc_mce UGenId
no_id
mkOscMCEId :: UGenId -> Rate -> String -> [UGen] -> UGen -> Int -> UGen
mkOscMCEId :: UGenId -> Rate -> String -> [UGen] -> UGen -> Int -> UGen
mkOscMCEId = UGenId -> Rate -> String -> [UGen] -> UGen -> Int -> UGen
mk_osc_mce
mk_filter :: [Rate] -> [Int] -> UGenId -> String -> [UGen] -> Int -> UGen
mk_filter :: [Rate] -> [Int] -> UGenId -> String -> [UGen] -> Int -> UGen
mk_filter [Rate]
rs [Int]
ix UGenId
z String
c [UGen]
i Int
o = 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]
rs ([Int] -> Either Rate [Int]
forall a b. b -> Either a b
Right [Int]
ix) String
c [UGen]
i Maybe [UGen]
forall a. Maybe a
Nothing Int
o (Int -> Special
Special Int
0) UGenId
z
mkFilterIdR :: [Rate] -> UGenId -> String -> [UGen] -> Int -> UGen
mkFilterIdR :: [Rate] -> UGenId -> String -> [UGen] -> Int -> UGen
mkFilterIdR [Rate]
rs UGenId
z String
nm [UGen]
i = [Rate] -> [Int] -> UGenId -> String -> [UGen] -> Int -> UGen
mk_filter [Rate]
rs [Int
0 .. [UGen] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [UGen]
i Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1] UGenId
z String
nm [UGen]
i
mkFilterR :: [Rate] -> String -> [UGen] -> Int -> UGen
mkFilterR :: [Rate] -> String -> [UGen] -> Int -> UGen
mkFilterR [Rate]
rs = [Rate] -> UGenId -> String -> [UGen] -> Int -> UGen
mkFilterIdR [Rate]
rs UGenId
no_id
mkFilter :: String -> [UGen] -> Int -> UGen
mkFilter :: String -> [UGen] -> Int -> UGen
mkFilter = [Rate] -> String -> [UGen] -> Int -> UGen
mkFilterR [Rate]
all_rates
mkFilterId :: UGenId -> String -> [UGen] -> Int -> UGen
mkFilterId :: UGenId -> String -> [UGen] -> Int -> UGen
mkFilterId = [Rate] -> UGenId -> String -> [UGen] -> Int -> UGen
mkFilterIdR [Rate]
all_rates
mk_filter_mce :: [Rate] -> UGenId -> String -> [UGen] -> UGen -> Int -> UGen
mk_filter_mce :: [Rate] -> UGenId -> String -> [UGen] -> UGen -> Int -> UGen
mk_filter_mce [Rate]
rs UGenId
z String
c [UGen]
i UGen
j = [Rate] -> UGenId -> String -> [UGen] -> Int -> UGen
mkFilterIdR [Rate]
rs UGenId
z String
c ([UGen]
i [UGen] -> [UGen] -> [UGen]
forall a. [a] -> [a] -> [a]
++ UGen -> [UGen]
mceChannels UGen
j)
mkFilterMCER :: [Rate] -> String -> [UGen] -> UGen -> Int -> UGen
mkFilterMCER :: [Rate] -> String -> [UGen] -> UGen -> Int -> UGen
mkFilterMCER [Rate]
rs = [Rate] -> UGenId -> String -> [UGen] -> UGen -> Int -> UGen
mk_filter_mce [Rate]
rs UGenId
no_id
mkFilterMCE :: String -> [UGen] -> UGen -> Int -> UGen
mkFilterMCE :: String -> [UGen] -> UGen -> Int -> UGen
mkFilterMCE = [Rate] -> UGenId -> String -> [UGen] -> UGen -> Int -> UGen
mk_filter_mce [Rate]
all_rates UGenId
no_id
mkFilterMCEId :: UGenId -> String -> [UGen] -> UGen -> Int -> UGen
mkFilterMCEId :: UGenId -> String -> [UGen] -> UGen -> Int -> UGen
mkFilterMCEId = [Rate] -> UGenId -> String -> [UGen] -> UGen -> Int -> UGen
mk_filter_mce [Rate]
all_rates
mkInfo :: String -> UGen
mkInfo :: String -> UGen
mkInfo String
name = Rate -> String -> [UGen] -> Int -> UGen
mkOsc Rate
IR String
name [] Int
1