Safe Haskell | None |
---|---|
Language | Haskell98 |
Extensions |
|
Library for interacting with the SuperCollider server.
You don't need to use much of this day-to-day
There's a toplevel scServerState
that stores the current state of the SC server
- call :: OSC -> IO ()
- callBS :: ByteString -> IO ()
- quit :: IO ()
- cmdPeriod :: IO ()
- newtype NodeId = NodeId {}
- newNodeId :: IO NodeId
- newtype BufferId = BufferId {
- unBufferId :: Int32
- newBufferId :: IO BufferId
- setMaxBufferIds :: Int32 -> IO ()
- makeBuffer :: Int32 -> IO BufferId
- makeBufferFromFile :: FilePath -> IO BufferId
- saveBuffer :: BufferId -> FilePath -> IO ()
- createSCServerConnection :: HostName -> ServiceName -> IO Socket
- callAndWaitForDone :: OSC -> IO ()
- data SCServerState = SCServerState {
- scServer_socket :: !(TVar (Maybe Socket))
- scServer_availableBufferIds :: !(TVar [BufferId])
- scServer_maxBufIds :: !(TVar Int32)
- scServer_availableNodeIds :: !(TVar [NodeId])
- scServer_availableSyncIds :: !(TVar [SyncId])
- scServer_definedSDs :: !(TVar (Set (SDName, Int)))
- scServerState :: SCServerState
Documentation
callBS :: ByteString -> IO () Source
Send a ByteString to the SuperCollider server.
You usually want to use call
instead. May be removed in future versions.
Your "emergency" button. Run this and everything playing on the SC server will be freed -- silence!
Corresponds to the cmd-. / ctrl-. key command in the SuperCollider IDE
setMaxBufferIds :: Int32 -> IO () Source
If you've started the SC server with a non-default number of buffer ids, (e.g. with the "-b" argument), you can reflect that here
Note that the buffer ids start at 512, to not clash with any that sclang has allocated
makeBuffer :: Int32 -> IO BufferId Source
Make an empty buffer
The Int32 is the buffer length in samples. Multiply seconds by the default sample rate of the server (usually 48000) to get the number of samples
makeBufferFromFile :: FilePath -> IO BufferId Source
Make a buffer and fill it with sound data from a file
saveBuffer :: BufferId -> FilePath -> IO () Source
Write a buffer to a file
createSCServerConnection :: HostName -> ServiceName -> IO Socket Source
You usually don't need to call this function
Use this if to connect on a non-default port or to a server not at localhost
Otherwise the connection is created when it's needed. You can also use this to explicitly create the connection, so the computation is done upfront
The HostName
is the ip address or "localhost". The ServiceName
is the port
callAndWaitForDone :: OSC -> IO () Source
Async messages to the sc server get responded to with "/done" -- so this calls those functions and waits for the "/done" before continuing
data SCServerState Source
SCServerState | |
|