Type specialised encode (big-endian).
Modulehosc-0.21.1Haskell2010
Sound.Osc.Coding.Byte
Byte-level coding utility functions.
Plain forms are big-endian, little-endian forms have _le suffix.
- 66 values
- Packagehosc-0.21.1
- Exports66
- LanguageHaskell2010
- LicenceGPL-3.0-only
- SourceByte.hs
Encode
10 declarationsType specialised encode (big-endian).
encode_int16 0x0102 == ByteString.Lazy.pack [0x01,0x02]True
Little-endian.
encode_int16_le 0x0102 == ByteString.Lazy.pack [0x02,0x01]True
Encode a signed 64-bit integer (big-endian).
Type specialised encode (big-endian).
Type specialised encode (big-endian).
encode_word16 0x0102 == ByteString.Lazy.pack [0x01,0x02]True
Little-endian.
encode_word16_le 0x0102 == ByteString.Lazy.pack [0x02,0x01]True
Type specialised encode.
Little-endian variant of encode_word32.
Encode an unsigned 64-bit integer.
Encode/Int
8 declarationsEncode a signed 8-bit integer.
Encode an un-signed 8-bit integer.
Encode an un-signed 16-bit integer.
encode_u16 0x0102 == ByteString.Lazy.pack [1,2]True
Little-endian.
encode_u16_le 0x0102 == ByteString.Lazy.pack [2,1]True
Encode a signed 16-bit integer.
Encode a signed 32-bit integer.
Encode an unsigned 32-bit integer.
ByteString.Lazy.unpack (encode_u32 0x01020304)[1,2,3,4]
Little-endian.
ByteString.Lazy.unpack (encode_u32_le 0x01020304)[4,3,2,1]
Encode/Float
4 declarationsEncode a 32-bit IEEE floating point number.
ByteString.Lazy.unpack (encode_f32 3.141)[64,73,6,37]
Little-endian variant of encode_f32.
ByteString.Lazy.unpack (encode_f32_le 3.141)[37,6,73,64]
Encode a 64-bit IEEE floating point number.
ByteString.Lazy.unpack (encode_f64 3.141)[64,9,32,196,155,165,227,84]
Little-endian variant of encode_f64.
ByteString.Lazy.unpack (encode_f64_le 3.141)[84,227,165,155,196,32,9,64]
Encode/Ascii
1 declarationEncode an Ascii string (Ascii at Datum is an alias for a Char8 Bytetring).
Decode
7 declarationsType specialised decode.
Little-endian variant of decode_word16.
Type specialised decode.
Type specialised decode.
Little-endian variant of decode_word32.
Type specialised decode.
Type specialised decode.
Decode/Int
10 declarationsDecode an un-signed 8-bit integer.
Decode a signed 8-bit integer.
Decode an unsigned 8-bit integer.
Little-endian variant of decode_u16.
Decode a signed 16-bit integer.
Little-endian variant of decode_i16.
Decode a signed 32-bit integer.
decode_i32 (ByteString.Lazy.pack [0x00,0x00,0x03,0xe7]) == 0x03e7True
Little-endian variant of decode_i32.
decode_i32_le (ByteString.Lazy.pack [0xe7,0x03,0x00,0x00]) == 0x03e7True
Decode an unsigned 32-bit integer.
decode_u32 (ByteString.Lazy.pack [1,2,3,4]) == 0x01020304True
Little-endian variant of decode_u32.
decode_u32_le (ByteString.Lazy.pack [1,2,3,4]) == 0x04030201True
Decode/Float
3 declarationsDecode a 32-bit IEEE floating point number.
decode_f32 (ByteString.Lazy.pack [64,73,6,37])3.141
Little-endian variant of decode_f32.
Decode a 64-bit IEEE floating point number.
Decode/Ascii
1 declarationDecode an Ascii string, inverse of encode_ascii.
IO
5 declarationsRead n bytes from h and run f.
Type-specialised reader for decode.
hPut of encode_word32.
hPut of encode_word32_le.
Io/Int
8 declarationsdecode_i16 of hGet.
decode_i32 of hGet.
decode_i32_le of hGet.
decode_u32 of hGet.
decode_u32_le of hGet.
hPut of encode_u32.
hPut of encode_u32_le.
Io/Float
2 declarationsdecode_f32 of hGet.
decode_f32_le of hGet.
Io/Ascii
1 declarationRead u8 length prefixed Ascii string (pascal string).
Util
3 declarationsBundle header as a (strict) ByteString.
ByteString.Char8.length bundleHeader_strict8
Bundle header as a lazy ByteString.
ByteString.Lazy.length bundleHeader8
The number of bytes required to align an Osc value to the next 4-byte boundary.
map align [0::Int .. 7][0,3,2,1,0,3,2,1]
map align [512::Int .. 519][0,3,2,1,0,3,2,1]
ByteString
3 declarationsIs machine little endian?
Byte-swap byte string in four-byte segments.
If target is little-endian, swap bytes to be in network order, else identity.