module Csound.Typed.Control (
    
    module Csound.Typed.GlobalState.SE,
    
    module Csound.Typed.Control.Ref,
    
    instr0, getIns, setDur,
    
    freshId,
    
    module Csound.Typed.Control.Mix,
    
    module Csound.Typed.Control.Midi,
    
    module Csound.Typed.Control.Api,
    
    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,
    
    module Csound.Typed.Control.InstrRef,
    
    module Csound.Typed.Control.ArrayTraverse,
    
    module Csound.Typed.Control.MacrosArgs
) where
import Csound.Typed.GlobalState.SE
import Csound.Typed.Control.Ref
import Csound.Typed.Control.Evt
import Csound.Typed.Control.Mix
import Csound.Typed.Control.Midi
import Csound.Typed.Control.Api
import Csound.Typed.Control.Osc
import Csound.Typed.Control.Channel
import Csound.Typed.Control.Sf2
import Csound.Typed.Control.Vco
import Csound.Typed.Control.InstrRef
import Csound.Typed.Control.ArrayTraverse
import Csound.Typed.Control.MacrosArgs
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