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 :: Str -> SE D
chnGetD = Rate -> Str -> SE D
forall a. Val a => Rate -> Str -> SE a
get Rate
Ir
chnGetCtrl :: Str -> SE Sig
chnGetCtrl :: Str -> SE Sig
chnGetCtrl = Rate -> Str -> SE Sig
forall a. Val a => Rate -> Str -> SE a
get Rate
Kr
chnGetSig :: Str -> SE Sig
chnGetSig :: Str -> SE Sig
chnGetSig = Rate -> Str -> SE Sig
forall a. Val a => Rate -> Str -> SE a
get Rate
Ar
chnGetStr :: Str -> SE Str
chnGetStr :: Str -> SE Str
chnGetStr = Rate -> Str -> SE Str
forall a. Val a => Rate -> Str -> SE a
get Rate
Sr
chnSetD :: D -> Str -> SE ()
chnSetD :: D -> Str -> SE ()
chnSetD = Rate -> D -> Str -> SE ()
forall a. Val a => Rate -> a -> Str -> SE ()
set Rate
Ir
chnSetSig :: Sig -> Str -> SE ()
chnSetSig :: Sig -> Str -> SE ()
chnSetSig = Rate -> Sig -> Str -> SE ()
forall a. Val a => Rate -> a -> Str -> SE ()
set Rate
Ar
chnSetCtrl :: Sig -> Str -> SE ()
chnSetCtrl :: Sig -> Str -> SE ()
chnSetCtrl = Rate -> Sig -> Str -> SE ()
forall a. Val a => Rate -> a -> Str -> SE ()
set Rate
Kr
chnSetStr :: Str -> Str -> SE ()
chnSetStr :: Str -> Str -> SE ()
chnSetStr = Rate -> Str -> Str -> SE ()
forall a. Val a => Rate -> a -> Str -> SE ()
set Rate
Sr
get :: Val a => Rate -> Str -> SE a
get :: Rate -> Str -> SE a
get Rate
rate Str
chn = (GE E -> a) -> SE (GE E) -> SE a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap GE E -> a
forall a. Val a => GE E -> a
fromGE (SE (GE E) -> SE a) -> SE (GE E) -> SE a
forall a b. (a -> b) -> a -> b
$ Dep E -> SE (GE E)
forall a. Dep a -> SE (GE a)
fromDep (Dep E -> SE (GE E)) -> Dep E -> SE (GE E)
forall a b. (a -> b) -> a -> b
$ (Rate -> E -> Dep E
forall (m :: * -> *). Monad m => Rate -> E -> DepT m E
chnGet Rate
rate) (E -> Dep E) -> Dep E -> Dep E
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< (GE E -> Dep E
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (GE E -> Dep E) -> GE E -> Dep E
forall a b. (a -> b) -> a -> b
$ Str -> GE E
unStr Str
chn)
set :: Val a => Rate -> a -> Str -> SE ()
set :: Rate -> a -> Str -> SE ()
set Rate
rate a
val Str
chn = Dep () -> SE ()
fromDep_ (Dep () -> SE ()) -> Dep () -> SE ()
forall a b. (a -> b) -> a -> b
$ do
E
v <- GE E -> Dep E
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (GE E -> Dep E) -> GE E -> Dep E
forall a b. (a -> b) -> a -> b
$ a -> GE E
forall a. Val a => a -> GE E
toGE a
val
E
c <- GE E -> Dep E
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (GE E -> Dep E) -> GE E -> Dep E
forall a b. (a -> b) -> a -> b
$ Str -> GE E
unStr Str
chn
Rate -> E -> E -> Dep ()
forall (m :: * -> *). Monad m => Rate -> E -> E -> DepT m ()
chnSet Rate
rate E
v E
c