hosc-0.21.1: Haskell Open Sound Control

Safe Haskell | None
Language | Haskell2010

Sound.Osc.Coding.Encode.Builder

Description

Optimised encode function for Osc packets.

Synopsis

- build_packet :: PacketOf Message -> Builder
- encodeMessage :: Message -> ByteString
- encodeBundle :: BundleOf Message -> ByteString
- encodePacket :: PacketOf Message -> ByteString
- encodePacket_strict :: PacketOf Message -> ByteString

# Documentation

build_packet :: PacketOf Message -> Builder Source #

Builder for an Osc `Packet`.

encodeMessage :: Message -> ByteString Source #

Encode an Osc `Message`, ie. `encodePacket` of `Packet_Message`.

    >>> let m = [47,103,95,102,114,101,101,0,44,105,0,0,0,0,0,0]
    >>> encodeMessage (Message "/g_free" [Int32 0]) == L.pack m
    True

encodeBundle :: BundleOf Message -> ByteString Source #

Encode an Osc `Bundle`, ie. `encodePacket` of `Packet_Bundle`.

    >>> let m = [47,103,95,102,114,101,101,0,44,105,0,0,0,0,0,0]
    >>> let b = [35,98,117,110,100,108,101,0,0,0,0,0,0,0,0,1,0,0,0,16] ++ m
    >>> encodeBundle (Bundle immediately [Message "/g_free" [Int32 0]]) == L.pack b
    True

encodePacket :: PacketOf Message -> ByteString Source #

Encode an Osc `Packet`.

encodePacket_strict :: PacketOf Message -> ByteString Source #

Encode an Osc `Packet` to a strict `ByteString`.