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

Sound.Osc.Coding.Encode.Base

Description

Base-level encode function for Osc packets (slow). For ordinary use see Builder.

Synopsis

Documentation

extend :: Word8 -> ByteString -> ByteString Source #

Align byte string, if required.

encode_datum :: Datum -> ByteString Source #

Encode Osc Datum.

MidiData: Bytes from MSB to LSB are: port id, status byte, data1, data2.

encode_datum (blob [1, 2, 3, 4]) == B.pack [0, 0, 0, 4, 1, 2, 3, 4]

encodeMessage :: Message -> ByteString Source #

Encode Osc Message.

m = Message "/n_set" [int32 (-1), string "freq", float 440, string "amp", float 0.1]
e = blob_unpack (encodeMessage m)
length e == 40
e == [47,110,95,115,101,116,0,0,44,105,115,102,115,102,0,0,255,255,255,255,102,114,101,113,0,0,0,0,67,220,0,0,97,109,112,0,61,204,204,205]

encode_message_blob :: Message -> Datum Source #

Encode Osc Message as an Osc blob.

encodeBundle :: Bundle -> ByteString Source #

Encode Osc Bundle.

b = Bundle 0.0 [m] e = blob_unpack (encodeBundle b) length e == 60 e == [35,98,117,110,100,108,101,0,0,0,0,0,0,0,0,0,0,0,0,40,47,110,95,115,101,116,0,0,44,105,115,102,115,102,0,0,255,255,255,255,102,114,101,113,0,0,0,0,67,220,0,0,97,109,112,0,61,204,204,205]