hosc-0.19.1: Haskell Open Sound Control
Safe HaskellSafe-Inferred
LanguageHaskell2010

Sound.OSC.Packet

Description

Data types for OSC messages, bundles and packets.

Synopsis

Message

type Address_Pattern = String Source #

OSC address pattern. This is strictly an ASCII value, however it is very common to pattern match on addresses and matching on Data.ByteString.Char8 requires OverloadedStrings.

data Message Source #

An OSC message, an Address_Pattern and a sequence of Datum.

Constructors

Message 

Instances

Instances details
Read Message Source # 
Instance details

Defined in Sound.OSC.Packet

Methods

readsPrec :: Int -> ReadS Message

readList :: ReadS [Message]

readPrec :: ReadPrec Message

readListPrec :: ReadPrec [Message]

Show Message Source # 
Instance details

Defined in Sound.OSC.Packet

Methods

showsPrec :: Int -> Message -> ShowS

show :: Message -> String

showList :: [Message] -> ShowS

Eq Message Source # 
Instance details

Defined in Sound.OSC.Packet

Methods

(==) :: Message -> Message -> Bool

(/=) :: Message -> Message -> Bool

message :: Address_Pattern -> [Datum] -> Message Source #

Message constructor. It is an error if the Address_Pattern doesn't conform to the OSC specification.

Bundle

data Bundle Source #

An OSC bundle, a Time and a sequence of Messages.

Constructors

Bundle 

Instances

Instances details
Read Bundle Source # 
Instance details

Defined in Sound.OSC.Packet

Methods

readsPrec :: Int -> ReadS Bundle

readList :: ReadS [Bundle]

readPrec :: ReadPrec Bundle

readListPrec :: ReadPrec [Bundle]

Show Bundle Source # 
Instance details

Defined in Sound.OSC.Packet

Methods

showsPrec :: Int -> Bundle -> ShowS

show :: Bundle -> String

showList :: [Bundle] -> ShowS

Eq Bundle Source # 
Instance details

Defined in Sound.OSC.Packet

Methods

(==) :: Bundle -> Bundle -> Bool

(/=) :: Bundle -> Bundle -> Bool

Ord Bundle Source #

OSC Bundles can be ordered (time ascending).

Instance details

Defined in Sound.OSC.Packet

Methods

compare :: Bundle -> Bundle -> Ordering

(<) :: Bundle -> Bundle -> Bool

(<=) :: Bundle -> Bundle -> Bool

(>) :: Bundle -> Bundle -> Bool

(>=) :: Bundle -> Bundle -> Bool

max :: Bundle -> Bundle -> Bundle

min :: Bundle -> Bundle -> Bundle

bundle :: Time -> [Message] -> Bundle Source #

Bundle constructor. It is an error if the Message list is empty.

Packet

data Packet Source #

An OSC Packet is either a Message or a Bundle.

Instances

Instances details
Read Packet Source # 
Instance details

Defined in Sound.OSC.Packet

Methods

readsPrec :: Int -> ReadS Packet

readList :: ReadS [Packet]

readPrec :: ReadPrec Packet

readListPrec :: ReadPrec [Packet]

Show Packet Source # 
Instance details

Defined in Sound.OSC.Packet

Methods

showsPrec :: Int -> Packet -> ShowS

show :: Packet -> String

showList :: [Packet] -> ShowS

Eq Packet Source # 
Instance details

Defined in Sound.OSC.Packet

Methods

(==) :: Packet -> Packet -> Bool

(/=) :: Packet -> Packet -> Bool

packetTime :: Packet -> Time Source #

The Time of Packet, if the Packet is a Message this is immediately.

packetMessages :: Packet -> [Message] Source #

Retrieve the set of Messages from a Packet.

packet_to_bundle :: Packet -> Bundle Source #

If Packet is a Message add immediately timestamp, else id.

packet_to_message :: Packet -> Maybe Message Source #

If Packet is a Message or a Bundle with an immediate time tag and with one element, return the Message, else Nothing.

packet_is_immediate :: Packet -> Bool Source #

Is Packet immediate, ie. a Bundle with timestamp immediately, or a plain Message.

at_packet :: (Message -> a) -> (Bundle -> a) -> Packet -> a Source #

Variant of either for Packet.

Address Query

bundle_has_address :: Address_Pattern -> Bundle -> Bool Source #

Do any of the Messages at Bundle have the specified Address_Pattern.

Pretty printing

messagePP :: FP_Precision -> Message -> String Source #

Pretty printer for Message.

messagePP Nothing (Message "/m" [int32 0,float 1.0,string "s",midi (1,2,3,4),blob [1,2,3]])

bundlePP :: FP_Precision -> Bundle -> String Source #

Pretty printer for Bundle.

packetPP :: FP_Precision -> Packet -> String Source #

Pretty printer for Packet.