module Csound.Typed.Types(
module Csound.Typed.Types.Prim,
module Csound.Typed.Types.Lift,
withInits, withDs, withSigs, withTabs, withD, withSig, withTab, withSeed,
module Csound.Typed.Types.Tuple,
module Csound.Typed.Types.Evt,
module Csound.Typed.Types.Array,
module Csound.Typed.Types.MonoArg,
module Csound.Typed.Types.SigSpace,
getNextGlobalGenId
) where
import qualified Csound.Dynamic as D
import Csound.Typed.Types.Prim
import Csound.Typed.Types.Tuple
import Csound.Typed.Types.Evt
import Csound.Typed.Types.Lift
import Csound.Typed.Types.Array
import Csound.Typed.Types.MonoArg
import Csound.Typed.Types.SigSpace
import Csound.Typed.GlobalState(evalSE, SE, geToSe)
import qualified Csound.Typed.GlobalState as G(getNextGlobalGenId)
getNextGlobalGenId :: SE Int
getNextGlobalGenId = geToSe G.getNextGlobalGenId
withInits :: (Tuple a, Tuple b) => a -> b -> a
withInits a b = genWithInits a (fromTuple b)
withDs :: Tuple a => a -> [D] -> a
withDs a ds = genWithInits a (mapM toGE ds)
withD :: Tuple a => a -> D -> a
withD = withInits
withSigs :: Tuple a => a -> [Sig] -> a
withSigs a sigs = genWithInits a (mapM toGE sigs)
withSig :: Tuple a => a -> Sig -> a
withSig = withInits
withTabs :: Tuple a => a -> [Tab] -> a
withTabs a tabs = genWithInits a (mapM toGE tabs)
withTab :: Tuple a => a -> Tab -> a
withTab = withInits
withSeed :: SE Sig -> D -> Sig
withSeed a d = hideGE $ evalSE $ fmap (flip withD d) a
genWithInits :: (Tuple a) => a -> GE [E] -> a
genWithInits a vals = toTuple $ do
as <- fromTuple a
vs <- vals
return $ fmap (\x -> D.withInits x vs) as