hosc-0.12: Haskell Open Sound Control

Safe HaskellNone

Sound.OSC.Transport.Monad

Contents

Description

Monad class implementing an Open Sound Control transport.

Synopsis

Documentation

class (Functor m, Monad m, MonadIO m) => Transport m whereSource

Methods

sendOSC :: OSC o => o -> m ()Source

Encode and send an OSC packet.

recvPacket :: m PacketSource

Receive and decode an OSC packet.

Instances

(Functor (ReaderT t io), Monad (ReaderT t io), MonadIO (ReaderT t io), Transport t, Functor io, MonadIO io) => Transport (ReaderT t io) 

type Connection t a = ReaderT t IO aSource

Transport connection.

withTransport :: Transport t => IO t -> Connection t a -> IO aSource

Bracket Open Sound Control communication.

Send

sendMessage :: Transport m => Message -> m ()Source

Type restricted synonym for sendOSC.

sendBundle :: Transport m => Bundle -> m ()Source

Type restricted synonym for sendOSC.

Receive

recvOSC :: (Transport m, OSC o) => m (Maybe o)Source

Variant of recvPacket that runs fromPacket.

Wait

waitUntil :: Transport m => (Packet -> Bool) -> m PacketSource

Wait for a Packet where the supplied predicate is True, discarding intervening packets.

waitFor :: Transport m => (Packet -> Maybe a) -> m aSource

Wait for a Packet where the supplied function does not give Nothing, discarding intervening packets.

waitMessage :: Transport m => m MessageSource

waitFor packet_to_message, ie. an incoming Message or immediate mode Bundle with one element.

waitAddress :: Transport m => Address_Pattern -> m PacketSource

A waitFor for variant using packet_has_address to match on the Address_Pattern of incoming Packets.

waitReply :: Transport m => Address_Pattern -> m MessageSource

Variant on waitAddress that returns matching Message.