module Sound.Sc3.Ugen.Control where
import Text.Printf
import Sound.Sc3.Common.Rate
import Sound.Sc3.Ugen.Brackets
data Control_Group
= Control_Range
| Control_Array Int
| Control_Xy
deriving (Eq Control_Group
Eq Control_Group =>
(Control_Group -> Control_Group -> Ordering)
-> (Control_Group -> Control_Group -> Bool)
-> (Control_Group -> Control_Group -> Bool)
-> (Control_Group -> Control_Group -> Bool)
-> (Control_Group -> Control_Group -> Bool)
-> (Control_Group -> Control_Group -> Control_Group)
-> (Control_Group -> Control_Group -> Control_Group)
-> Ord Control_Group
Control_Group -> Control_Group -> Bool
Control_Group -> Control_Group -> Ordering
Control_Group -> Control_Group -> Control_Group
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Control_Group -> Control_Group -> Ordering
compare :: Control_Group -> Control_Group -> Ordering
$c< :: Control_Group -> Control_Group -> Bool
< :: Control_Group -> Control_Group -> Bool
$c<= :: Control_Group -> Control_Group -> Bool
<= :: Control_Group -> Control_Group -> Bool
$c> :: Control_Group -> Control_Group -> Bool
> :: Control_Group -> Control_Group -> Bool
$c>= :: Control_Group -> Control_Group -> Bool
>= :: Control_Group -> Control_Group -> Bool
$cmax :: Control_Group -> Control_Group -> Control_Group
max :: Control_Group -> Control_Group -> Control_Group
$cmin :: Control_Group -> Control_Group -> Control_Group
min :: Control_Group -> Control_Group -> Control_Group
Ord, Control_Group -> Control_Group -> Bool
(Control_Group -> Control_Group -> Bool)
-> (Control_Group -> Control_Group -> Bool) -> Eq Control_Group
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Control_Group -> Control_Group -> Bool
== :: Control_Group -> Control_Group -> Bool
$c/= :: Control_Group -> Control_Group -> Bool
/= :: Control_Group -> Control_Group -> Bool
Eq, ReadPrec [Control_Group]
ReadPrec Control_Group
Int -> ReadS Control_Group
ReadS [Control_Group]
(Int -> ReadS Control_Group)
-> ReadS [Control_Group]
-> ReadPrec Control_Group
-> ReadPrec [Control_Group]
-> Read Control_Group
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Control_Group
readsPrec :: Int -> ReadS Control_Group
$creadList :: ReadS [Control_Group]
readList :: ReadS [Control_Group]
$creadPrec :: ReadPrec Control_Group
readPrec :: ReadPrec Control_Group
$creadListPrec :: ReadPrec [Control_Group]
readListPrec :: ReadPrec [Control_Group]
Read, Int -> Control_Group -> ShowS
[Control_Group] -> ShowS
Control_Group -> String
(Int -> Control_Group -> ShowS)
-> (Control_Group -> String)
-> ([Control_Group] -> ShowS)
-> Show Control_Group
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Control_Group -> ShowS
showsPrec :: Int -> Control_Group -> ShowS
$cshow :: Control_Group -> String
show :: Control_Group -> String
$cshowList :: [Control_Group] -> ShowS
showList :: [Control_Group] -> ShowS
Show)
control_group_degree :: Control_Group -> Int
control_group_degree :: Control_Group -> Int
control_group_degree Control_Group
grp =
case Control_Group
grp of
Control_Group
Control_Range -> Int
2
Control_Array Int
n -> Int
n
Control_Group
Control_Xy -> Int
2
control_group_suffixes :: Control_Group -> [String]
control_group_suffixes :: Control_Group -> [String]
control_group_suffixes Control_Group
grp =
case Control_Group
grp of
Control_Group
Control_Range -> [String
"[", String
"]"]
Control_Array Int
n -> (Int -> String) -> [Int] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map (String -> Int -> String
forall r. PrintfType r => String -> r
printf String
"%02d") [Int
0 .. Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1]
Control_Group
Control_Xy -> [String
"X", String
"Y"]
data Control_Meta n = Control_Meta
{ forall n. Control_Meta n -> n
ctl_min :: n
, forall n. Control_Meta n -> n
ctl_max :: n
, forall n. Control_Meta n -> String
ctl_warp :: String
, forall n. Control_Meta n -> n
ctl_step :: n
, forall n. Control_Meta n -> String
ctl_units :: String
, forall n. Control_Meta n -> Maybe Control_Group
controlGroup :: Maybe Control_Group
}
deriving (Eq (Control_Meta n)
Eq (Control_Meta n) =>
(Control_Meta n -> Control_Meta n -> Ordering)
-> (Control_Meta n -> Control_Meta n -> Bool)
-> (Control_Meta n -> Control_Meta n -> Bool)
-> (Control_Meta n -> Control_Meta n -> Bool)
-> (Control_Meta n -> Control_Meta n -> Bool)
-> (Control_Meta n -> Control_Meta n -> Control_Meta n)
-> (Control_Meta n -> Control_Meta n -> Control_Meta n)
-> Ord (Control_Meta n)
Control_Meta n -> Control_Meta n -> Bool
Control_Meta n -> Control_Meta n -> Ordering
Control_Meta n -> Control_Meta n -> Control_Meta n
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall n. Ord n => Eq (Control_Meta n)
forall n. Ord n => Control_Meta n -> Control_Meta n -> Bool
forall n. Ord n => Control_Meta n -> Control_Meta n -> Ordering
forall n.
Ord n =>
Control_Meta n -> Control_Meta n -> Control_Meta n
$ccompare :: forall n. Ord n => Control_Meta n -> Control_Meta n -> Ordering
compare :: Control_Meta n -> Control_Meta n -> Ordering
$c< :: forall n. Ord n => Control_Meta n -> Control_Meta n -> Bool
< :: Control_Meta n -> Control_Meta n -> Bool
$c<= :: forall n. Ord n => Control_Meta n -> Control_Meta n -> Bool
<= :: Control_Meta n -> Control_Meta n -> Bool
$c> :: forall n. Ord n => Control_Meta n -> Control_Meta n -> Bool
> :: Control_Meta n -> Control_Meta n -> Bool
$c>= :: forall n. Ord n => Control_Meta n -> Control_Meta n -> Bool
>= :: Control_Meta n -> Control_Meta n -> Bool
$cmax :: forall n.
Ord n =>
Control_Meta n -> Control_Meta n -> Control_Meta n
max :: Control_Meta n -> Control_Meta n -> Control_Meta n
$cmin :: forall n.
Ord n =>
Control_Meta n -> Control_Meta n -> Control_Meta n
min :: Control_Meta n -> Control_Meta n -> Control_Meta n
Ord, Control_Meta n -> Control_Meta n -> Bool
(Control_Meta n -> Control_Meta n -> Bool)
-> (Control_Meta n -> Control_Meta n -> Bool)
-> Eq (Control_Meta n)
forall n. Eq n => Control_Meta n -> Control_Meta n -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall n. Eq n => Control_Meta n -> Control_Meta n -> Bool
== :: Control_Meta n -> Control_Meta n -> Bool
$c/= :: forall n. Eq n => Control_Meta n -> Control_Meta n -> Bool
/= :: Control_Meta n -> Control_Meta n -> Bool
Eq, ReadPrec [Control_Meta n]
ReadPrec (Control_Meta n)
Int -> ReadS (Control_Meta n)
ReadS [Control_Meta n]
(Int -> ReadS (Control_Meta n))
-> ReadS [Control_Meta n]
-> ReadPrec (Control_Meta n)
-> ReadPrec [Control_Meta n]
-> Read (Control_Meta n)
forall n. Read n => ReadPrec [Control_Meta n]
forall n. Read n => ReadPrec (Control_Meta n)
forall n. Read n => Int -> ReadS (Control_Meta n)
forall n. Read n => ReadS [Control_Meta n]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: forall n. Read n => Int -> ReadS (Control_Meta n)
readsPrec :: Int -> ReadS (Control_Meta n)
$creadList :: forall n. Read n => ReadS [Control_Meta n]
readList :: ReadS [Control_Meta n]
$creadPrec :: forall n. Read n => ReadPrec (Control_Meta n)
readPrec :: ReadPrec (Control_Meta n)
$creadListPrec :: forall n. Read n => ReadPrec [Control_Meta n]
readListPrec :: ReadPrec [Control_Meta n]
Read, Int -> Control_Meta n -> ShowS
[Control_Meta n] -> ShowS
Control_Meta n -> String
(Int -> Control_Meta n -> ShowS)
-> (Control_Meta n -> String)
-> ([Control_Meta n] -> ShowS)
-> Show (Control_Meta n)
forall n. Show n => Int -> Control_Meta n -> ShowS
forall n. Show n => [Control_Meta n] -> ShowS
forall n. Show n => Control_Meta n -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall n. Show n => Int -> Control_Meta n -> ShowS
showsPrec :: Int -> Control_Meta n -> ShowS
$cshow :: forall n. Show n => Control_Meta n -> String
show :: Control_Meta n -> String
$cshowList :: forall n. Show n => [Control_Meta n] -> ShowS
showList :: [Control_Meta n] -> ShowS
Show)
type Control_Meta_T3 n = (n, n, String)
control_meta_t3 :: Num m => (n -> m) -> Control_Meta_T3 n -> Control_Meta m
control_meta_t3 :: forall m n.
Num m =>
(n -> m) -> Control_Meta_T3 n -> Control_Meta m
control_meta_t3 n -> m
f (n
l, n
r, String
w) = m
-> m
-> String
-> m
-> String
-> Maybe Control_Group
-> Control_Meta m
forall n.
n
-> n
-> String
-> n
-> String
-> Maybe Control_Group
-> Control_Meta n
Control_Meta (n -> m
f n
l) (n -> m
f n
r) String
w m
0 String
"" Maybe Control_Group
forall a. Maybe a
Nothing
type Control_Meta_T5 n = (n, n, String, n, String)
control_meta_t5 :: (n -> m) -> Control_Meta_T5 n -> Control_Meta m
control_meta_t5 :: forall n m. (n -> m) -> Control_Meta_T5 n -> Control_Meta m
control_meta_t5 n -> m
f (n
l, n
r, String
w, n
stp, String
u) = m
-> m
-> String
-> m
-> String
-> Maybe Control_Group
-> Control_Meta m
forall n.
n
-> n
-> String
-> n
-> String
-> Maybe Control_Group
-> Control_Meta n
Control_Meta (n -> m
f n
l) (n -> m
f n
r) String
w (n -> m
f n
stp) String
u Maybe Control_Group
forall a. Maybe a
Nothing
data Control = Control
{ Control -> Rate
controlOperatingRate :: Rate
, Control -> Maybe Int
controlIndex :: Maybe Int
, Control -> String
controlName :: String
, Control -> Double
controlDefault :: Double
, Control -> Bool
controlTriggered :: Bool
, Control -> Maybe (Control_Meta Double)
controlMeta :: Maybe (Control_Meta Double)
, Control -> Brackets
controlBrackets :: Brackets
}
deriving (Eq Control
Eq Control =>
(Control -> Control -> Ordering)
-> (Control -> Control -> Bool)
-> (Control -> Control -> Bool)
-> (Control -> Control -> Bool)
-> (Control -> Control -> Bool)
-> (Control -> Control -> Control)
-> (Control -> Control -> Control)
-> Ord Control
Control -> Control -> Bool
Control -> Control -> Ordering
Control -> Control -> Control
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Control -> Control -> Ordering
compare :: Control -> Control -> Ordering
$c< :: Control -> Control -> Bool
< :: Control -> Control -> Bool
$c<= :: Control -> Control -> Bool
<= :: Control -> Control -> Bool
$c> :: Control -> Control -> Bool
> :: Control -> Control -> Bool
$c>= :: Control -> Control -> Bool
>= :: Control -> Control -> Bool
$cmax :: Control -> Control -> Control
max :: Control -> Control -> Control
$cmin :: Control -> Control -> Control
min :: Control -> Control -> Control
Ord, Control -> Control -> Bool
(Control -> Control -> Bool)
-> (Control -> Control -> Bool) -> Eq Control
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Control -> Control -> Bool
== :: Control -> Control -> Bool
$c/= :: Control -> Control -> Bool
/= :: Control -> Control -> Bool
Eq, ReadPrec [Control]
ReadPrec Control
Int -> ReadS Control
ReadS [Control]
(Int -> ReadS Control)
-> ReadS [Control]
-> ReadPrec Control
-> ReadPrec [Control]
-> Read Control
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Control
readsPrec :: Int -> ReadS Control
$creadList :: ReadS [Control]
readList :: ReadS [Control]
$creadPrec :: ReadPrec Control
readPrec :: ReadPrec Control
$creadListPrec :: ReadPrec [Control]
readListPrec :: ReadPrec [Control]
Read, Int -> Control -> ShowS
[Control] -> ShowS
Control -> String
(Int -> Control -> ShowS)
-> (Control -> String) -> ([Control] -> ShowS) -> Show Control
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Control -> ShowS
showsPrec :: Int -> Control -> ShowS
$cshow :: Control -> String
show :: Control -> String
$cshowList :: [Control] -> ShowS
showList :: [Control] -> ShowS
Show)