module Csound.Typed.Control.Channel(
chnGetD, chnGetSig, chnGetCtrl, chnGetStr,
chnSetD, chnSetSig, chnSetCtrl, chnSetStr
) where
import Control.Monad.Trans.Class
import Csound.Dynamic(Rate(..))
import Csound.Typed.Types
import Csound.Typed.GlobalState
chnGetD :: Str -> SE D
chnGetD = get Ir
chnGetCtrl :: Str -> SE Sig
chnGetCtrl = get Kr
chnGetSig :: Str -> SE Sig
chnGetSig = get Ar
chnGetStr :: Str -> SE Str
chnGetStr = get Sr
chnSetD :: D -> Str -> SE ()
chnSetD = set Ir
chnSetSig :: Sig -> Str -> SE ()
chnSetSig = set Ar
chnSetCtrl :: Sig -> Str -> SE ()
chnSetCtrl = set Kr
chnSetStr :: Str -> Str -> SE ()
chnSetStr = set Sr
get :: Val a => Rate -> Str -> SE a
get rate chn = fmap fromGE $ fromDep $ (chnGet rate) =<< (lift $ unStr chn)
set :: Val a => Rate -> a -> Str -> SE ()
set rate val chn = fromDep_ $ do
v <- lift $ toGE val
c <- lift $ unStr chn
chnSet rate v c