{-# Language TypeFamilies #-}
module Csound.Typed.Control.Sf2(
Sf(..), unSf
) where
import Data.Boolean
import Data.Default
import qualified Csound.Dynamic as D
import Csound.Typed.Types
import Csound.Typed.GlobalState
data Sf = Sf
{ Sf -> String
sfName :: String
, Sf -> Int
sfBank :: Int
, Sf -> Int
sfProg :: Int }
| SfId (GE E)
instance Val Sf where
fromGE :: GE E -> Sf
fromGE = GE E -> Sf
SfId
toGE :: Sf -> GE E
toGE = Sf -> GE E
unSf
unSf :: Sf -> GE E
unSf :: Sf -> GE E
unSf Sf
x = case Sf
x of
SfId GE E
a -> GE E
a
Sf String
name Int
bank Int
prog -> (Int -> E) -> GE Int -> GE E
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> E
D.int (GE Int -> GE E) -> GE Int -> GE E
forall a b. (a -> b) -> a -> b
$ SfSpec -> GE Int
saveSf (String -> Int -> Int -> SfSpec
SfSpec String
name Int
bank Int
prog)
instance Default Sf where
def :: Sf
def = E -> Sf
forall a. Val a => E -> a
fromE E
0
type instance BooleanOf Sf = BoolD
instance IfB Sf where ifB :: bool -> Sf -> Sf -> Sf
ifB = (E -> E -> E -> E) -> bool -> Sf -> Sf -> Sf
forall a b c d.
(Val a, Val b, Val c, Val d) =>
(E -> E -> E -> E) -> a -> b -> c -> d
on3 E -> E -> E -> E
forall a bool. (IfB a, bool ~ BooleanOf a) => bool -> a -> a -> a
ifB