module Csound.Typed.Control (
    
    module Csound.Typed.GlobalState.SE,
    
    module Csound.Typed.Control.SERef,
    
    instr0, getIns, setDur,
    
    freshId,
    
    module Csound.Typed.Control.Mix,
    
    module Csound.Typed.Control.Midi,
    
    module Csound.Typed.Control.Osc,
    
    module Csound.Typed.Control.Channel,
    
    module Csound.Typed.Control.Sf2,
    
    module Csound.Typed.Control.Evt,
    
    module Csound.Typed.Control.Vco
) where
import Csound.Typed.GlobalState.SE
import Csound.Typed.Control.SERef
import Csound.Typed.Control.Evt
import Csound.Typed.Control.Mix
import Csound.Typed.Control.Midi
import Csound.Typed.Control.Osc
import Csound.Typed.Control.Channel
import Csound.Typed.Control.Sf2
import Csound.Typed.Control.Vco
import Csound.Typed.Types
import Csound.Typed.GlobalState
instr0 :: Tuple a => SE a -> SE a
instr0 a = return $ toTuple $ saveIns0 ins0Arity (tupleRates $ proxy a) ins0Exp
    where
        ins0Exp = execGEinSE $ fmap fromTuple a
        ins0Arity = tupleArity $ proxy a
        proxy :: Tuple a => SE a -> a
        proxy = const (toTuple $ return $ repeat undefined)
getIns :: Sigs a => SE a
getIns = res
    where 
        res = fmap toTuple $ fromDep $ getIn (tupleArity $ proxy res) 
        proxy :: SE a -> a
        proxy = const undefined
setDur :: Sigs a => D -> a -> a
setDur mdt as = toTuple $ do
    dt <- toGE mdt
    vals <- fromTuple as
    setDurationForce dt
    return vals
freshId :: SE D
freshId = SE $ fmap fromE freeChn