hosc-0.13: Haskell Open Sound Control

Safe HaskellNone

Sound.OpenSoundControl.Type

Contents

Description

Alegbraic data types for OSC datum and packets.

Synopsis

Documentation

type Datum_Type = CharSource

Type enumerating Datum categories.

data Datum Source

The basic elements of OSC messages.

Instances

type Address_Pattern = StringSource

OSC address pattern.

data Message Source

An OSC message.

data Bundle Source

An OSC bundle.

Constructors

Bundle 

Instances

Eq Bundle 
Ord Bundle

OSC Bundles can be ordered (time ascending).

Read Bundle 
Show Bundle 
OSC Bundle 

data Packet Source

An OSC Packet is either a Message or a Bundle.

bundle :: Time -> [Message] -> BundleSource

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

message :: Address_Pattern -> [Datum] -> MessageSource

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

Datum

datum_tag :: Datum -> Datum_TypeSource

Single character identifier of an OSC datum.

readMaybe :: Read a => String -> Maybe aSource

Variant of read.

parse_datum :: Datum_Type -> String -> Maybe DatumSource

Given Datum_Type attempt to parse Datum at String.

 parse_datum 'i' "42" == Just (Int 42)
 parse_datum 'f' "3.14159" == Just (Float 3.14159)
 parse_datum 'd' "3.14159" == Just (Double 3.14159)
 parse_datum 's' "\"pi\"" == Just (String "pi")
 parse_datum 'b' "pi" == Just (Blob (B.pack [112,105]))
 parse_datum 'm' "(0,144,60,90)" == Just (Midi (0,144,60,90))

datum_real :: Datum -> Maybe DoubleSource

Datum as real number if Double, Float or Int, else Nothing.

 map datum_real [Int 5,Float 5,String "5"] == [Just 5,Just 5,Nothing]

datum_real_err :: Datum -> DoubleSource

A fromJust variant of datum_real.

 map datum_real_err [Int 5,Float 5] == [5,5]

datum_int :: Integral i => Datum -> Maybe iSource

Datum as integral number if Double, Float or Int, else Nothing.

 map datum_int [Int 5,Float 5.5,String "5"] == [Just 5,Just 5,Nothing]

datum_int_err :: Integral i => Datum -> iSource

A fromJust variant of datum_int.

 map datum_int_err [Int 5,Float 5.5] == [5,5]

datum_string :: Datum -> Maybe StringSource

Datum as String if String or Blob, else Nothing.

 map datum_string [String "5",Blob (B.pack [53])] == [Just "5",Just "5"]

datum_string_err :: Datum -> StringSource

A fromJust variant of datum_string.

 map datum_string_err [String "5",Blob (B.pack [53])] == ["5","5"]

Address

bundle_has_address :: Address_Pattern -> Bundle -> BoolSource

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

Packet

packetTime :: Packet -> TimeSource

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 -> BundleSource

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

packet_to_message :: Packet -> Maybe MessageSource

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 -> BoolSource

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

at_packet :: (Message -> a) -> (Bundle -> a) -> Packet -> aSource

Variant of either for Packet.

Pretty printing

timePP :: Time -> StringSource

Pretty printer for Time.

datumPP :: Datum -> StringSource

Pretty printer for Datum.

 map datumPP [Float 1.2,String "str",Midi (0,0x90,0x40,0x60)]

messagePP :: Message -> StringSource

Pretty printer for Message.

bundlePP :: Bundle -> StringSource

Pretty printer for Bundle.

packetPP :: Packet -> StringSource

Pretty printer for Packet.