module Sound.SC3.Server.State.Monad.Class (
MonadServer(..)
, serverOption
, MonadIdAllocator(..)
, RequestOSC(..)
) where
import Control.Monad (liftM)
import Sound.OSC (OSC)
import Sound.OSC.Transport.Monad (SendOSC)
import Sound.SC3.Server.Allocator (Id, IdAllocator, RangeAllocator, Statistics)
import Sound.SC3.Server.Allocator.Range (Range)
import Sound.SC3.Server.Notification (Notification)
import Sound.SC3.Server.State ( AudioBusIdAllocator
, ControlBusIdAllocator
, BufferIdAllocator
, NodeId
, NodeIdAllocator
, SyncIdAllocator )
import Sound.SC3.Server.Process (ServerOptions)
class Monad m => MonadServer m where
serverOptions :: m ServerOptions
rootNodeId :: m NodeId
serverOption :: MonadServer m => (ServerOptions -> a) -> m a
serverOption = flip liftM serverOptions
class Monad m => MonadIdAllocator m where
data Allocator m a
nodeIdAllocator :: Allocator m NodeIdAllocator
syncIdAllocator :: Allocator m SyncIdAllocator
bufferIdAllocator :: Allocator m BufferIdAllocator
audioBusIdAllocator :: Allocator m AudioBusIdAllocator
controlBusIdAllocator :: Allocator m ControlBusIdAllocator
alloc :: IdAllocator a => Allocator m a -> m (Id a)
free :: IdAllocator a => Allocator m a -> Id a -> m ()
statistics :: IdAllocator a => Allocator m a -> m Statistics
allocRange :: RangeAllocator a => Allocator m a -> Int -> m (Range (Id a))
freeRange :: RangeAllocator a => Allocator m a -> Range (Id a) -> m ()
class SendOSC m => RequestOSC m where
request :: OSC o => o -> Notification a -> m a
requestAll :: OSC o => o -> [Notification a] -> m [a]