{- | Bookkeeping of SuperCollider channels -} module Haskore.Interface.SuperCollider.Channel where -- import qualified Sound.OpenSoundControl.Transport.Monad as Trans import qualified Sound.SC3.UGen.UGen as SCUGen import qualified Sound.SC3.UGen.IO as SCIO import qualified Sound.SC3.UGen.Rate as SCRate import Sound.SC3.UGen.UGen (UGen) type Channel = Int type NumberChannels = Int {- | We reserve the first two channels for the stereo output. We must not use them for instruments. This is too unflexible and will certainly change in the future. -} least :: Channel least = 2 data T m = Cons { next :: NumberChannels -> m Channel, reset :: m () -- liftTransport :: Trans.IO t a -> m a } readUGen :: NumberChannels -> Channel -> UGen readUGen numChan chan = SCIO.in' numChan SCRate.AR (SCUGen.Constant (fromIntegral chan)) writeUGen :: Channel -> UGen -> UGen writeUGen chan = SCIO.out (SCUGen.Constant (fromIntegral chan))