hosc-0.21: 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

Show Message Source # 
Instance details

Defined in Sound.Osc.Packet

Eq Message Source # 
Instance details

Defined in Sound.Osc.Packet

Methods

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

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

Ord Message Source # 
Instance details

Defined in Sound.Osc.Packet

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 BundleOf t Source #

An Osc bundle, a Time and a sequence of Messages. The type parameter specifies the element type. Ordinarily this is Message, which does not allow recursion.

Constructors

Bundle 

Fields

Instances

Instances details
Read t => Read (BundleOf t) Source # 
Instance details

Defined in Sound.Osc.Packet

Show t => Show (BundleOf t) Source # 
Instance details

Defined in Sound.Osc.Packet

Methods

showsPrec :: Int -> BundleOf t -> ShowS #

show :: BundleOf t -> String #

showList :: [BundleOf t] -> ShowS #

Eq t => Eq (BundleOf t) Source # 
Instance details

Defined in Sound.Osc.Packet

Methods

(==) :: BundleOf t -> BundleOf t -> Bool #

(/=) :: BundleOf t -> BundleOf t -> Bool #

Eq t => Ord (BundleOf t) Source #

Osc BundleOfs can be ordered (time ascending).

Instance details

Defined in Sound.Osc.Packet

Methods

compare :: BundleOf t -> BundleOf t -> Ordering #

(<) :: BundleOf t -> BundleOf t -> Bool #

(<=) :: BundleOf t -> BundleOf t -> Bool #

(>) :: BundleOf t -> BundleOf t -> Bool #

(>=) :: BundleOf t -> BundleOf t -> Bool #

max :: BundleOf t -> BundleOf t -> BundleOf t #

min :: BundleOf t -> BundleOf t -> BundleOf t #

bundle :: Time -> [t] -> BundleOf t Source #

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

Packet

data PacketOf t Source #

An Osc Packet is either a Message or a 'Bundle t'.

Constructors

Packet_Message 
Packet_Bundle 

Fields

Instances

Instances details
Read t => Read (PacketOf t) Source # 
Instance details

Defined in Sound.Osc.Packet

Show t => Show (PacketOf t) Source # 
Instance details

Defined in Sound.Osc.Packet

Methods

showsPrec :: Int -> PacketOf t -> ShowS #

show :: PacketOf t -> String #

showList :: [PacketOf t] -> ShowS #

Eq t => Eq (PacketOf t) Source # 
Instance details

Defined in Sound.Osc.Packet

Methods

(==) :: PacketOf t -> PacketOf t -> Bool #

(/=) :: PacketOf t -> PacketOf t -> Bool #

immediately :: Time Source #

Constant indicating a bundle to be executed immediately. It has the Ntp64 representation of 1.

>>> immediately == (1 / (2 ^ 32))
True

packetTime :: PacketOf t -> Time Source #

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

packetMessages :: PacketOf Message -> [Message] Source #

Retrieve the set of Messages from a Packet.

packet_to_message :: PacketOf Message -> Maybe Message Source #

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

packet_is_immediate :: PacketOf t -> Bool Source #

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

at_packet :: (Message -> a) -> (BundleOf t -> a) -> PacketOf t -> a Source #

Variant of either for Packet.

Address Query

bundle_has_address :: Address_Pattern -> BundleOf Message -> Bool Source #

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