hosc-0.15: Haskell Open Sound Control

Safe Haskell | Safe
Language | Haskell98

Sound.OSC.Datum

Description

`Datum` related functions.

Synopsis

- datum_int32 :: Datum -> Maybe Int32
- datum_int64 :: Datum -> Maybe Int64
- datum_float :: Datum -> Maybe Float
- datum_double :: Datum -> Maybe Double
- datum_ascii :: Datum -> Maybe ASCII
- datum_string :: Datum -> Maybe String
- datum_blob :: Datum -> Maybe ByteString
- datum_timestamp :: Datum -> Maybe Time
- datum_midi :: Datum -> Maybe MIDI
- datum_sequence :: Datum -> Maybe [Word8]

# Documentation

datum_int32 :: Datum -> Maybe Int32 Source #

Type specialised `d_get`.

    map datum_int32 [Int32 1,Float 1] == [Just 1,Nothing]

datum_int64 :: Datum -> Maybe Int64 Source #

Type specialised `d_get`.

datum_float :: Datum -> Maybe Float Source #

Type specialised `d_get`.

datum_double :: Datum -> Maybe Double Source #

Type specialised `d_get`.

datum_ascii :: Datum -> Maybe ASCII Source #

Type specialised `d_get`.

    datum_ascii (d_put (C.pack "string")) == Just (C.pack "string")

datum_string :: Datum -> Maybe String Source #

`unpack` of `d_get`.

    datum_string (d_put (C.pack "string")) == Just "string"
    map datum_string [string "string",Int32 5] == [Just "string",Nothing]

datum_blob :: Datum -> Maybe ByteString Source #

Type specialised `d_get`.

datum_timestamp :: Datum -> Maybe Time Source #

`Maybe` variant of `d_timestamp`.

datum_midi :: Datum -> Maybe MIDI Source #

Type specialised `d_get`.

datum_sequence :: Datum -> Maybe [Word8] Source #

`Datum` as sequence of `Word8` if `ASCII_String`, `Blob` or `Midi`.

    let d = [string "5",Blob (B.pack [53]),midi (0x00,0x90,0x40,0x60)]
    in Data.Maybe.mapMaybe datum_sequence d == [[53],[53],[0,144,64,96]]