Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Sound.Osc.Datum
Description
Osc data types.
Synopsis
- type DatumType = Char
- type Ascii = ByteString
- ascii :: String -> Ascii
- ascii_to_string :: Ascii -> String
- type Blob = ByteString
- blob_pack :: [Word8] -> Blob
- blob_unpack :: Blob -> [Word8]
- blob_unpack_int :: Blob -> [Int]
- data MidiData = MidiData !Word8 !Word8 !Word8 !Word8
- midi_pack :: [Word8] -> MidiData
- midi_unpack_int :: MidiData -> [Int]
- type Time = Double
- data Datum
- osc_types_required :: [(DatumType, String)]
- osc_types_optional :: [(DatumType, String)]
- osc_types :: [(DatumType, String)]
- osc_type_name :: DatumType -> Maybe String
- osc_type_name_err :: DatumType -> String
- datum_tag :: Datum -> DatumType
- datum_type_name :: Datum -> (DatumType, String)
- datum_integral :: Integral i => Datum -> Maybe i
- datum_floating :: Floating n => Datum -> Maybe n
- int32 :: Integral n => n -> Datum
- int64 :: Integral n => n -> Datum
- float :: Real n => n -> Datum
- double :: Real n => n -> Datum
- string :: String -> Datum
- midi :: (Word8, Word8, Word8, Word8) -> Datum
- blob :: [Word8] -> Datum
- signatureFor :: [Datum] -> String
- descriptor :: [Datum] -> Ascii
- descriptor_tags :: Ascii -> Ascii
Datum
ascii_to_string :: Ascii -> String Source #
Type-specialised unpack.
blob_unpack :: Blob -> [Word8] Source #
Type-specialised unpack.
blob_unpack_int :: Blob -> [Int] Source #
Type-specialised unpack.
Four-byte midi message: port-id, status-byte, data, data.
Constructors
MidiData !Word8 !Word8 !Word8 !Word8 |
midi_unpack_int :: MidiData -> [Int] Source #
Type-specialised unpack.
A real-valued time stamp. For Osc proper this is an Ntp64 time in real-valued (fractional) form. For SuperCollider Nrt programs this is elapsed time since the start of the score. This is the primary form of timestamp used by hosc.
The basic elements of Osc messages.
Constructors
Int32 | |
Fields
| |
Int64 | |
Fields
| |
Float | |
Fields
| |
Double | |
Fields
| |
AsciiString | |
Fields
| |
Blob | |
TimeStamp | |
Fields
| |
Midi | |
Datum types
osc_types_required :: [(DatumType, String)] Source #
List of required data types (tag, name).
osc_types_optional :: [(DatumType, String)] Source #
List of optional data types (tag,name).
osc_type_name :: DatumType -> Maybe String Source #
Lookup name of type.
osc_type_name_err :: DatumType -> String Source #
Erroring variant.
Generalised element access
datum_integral :: Integral i => Datum -> Maybe i Source #
Datum
as Integral
if Int32 or Int64.
let d = [Int32 5,Int64 5,Float 5.5,Double 5.5] map datum_integral d == [Just (5::Int),Just 5,Nothing,Nothing]
datum_floating :: Floating n => Datum -> Maybe n Source #
Datum
as Floating
if Int32, Int64, Float, Double or TimeStamp.
let d = [Int32 5,Int64 5,Float 5,Double 5,TimeStamp 5] mapMaybe datum_floating d == replicate 5 (5::Double)
Constructors
int32 :: Integral n => n -> Datum Source #
Type generalised Datum
.
int32 (1::Int32) == int32 (1::Integer) d_int32 (int32 (maxBound::Int32)) == maxBound int32 (((2::Int) ^ (64::Int))::Int) == Int32 0
int64 :: Integral n => n -> Datum Source #
Type generalised Int64.
int64 (1::Int32) == int64 (1::Integer) d_int64 (int64 (maxBound::Int64)) == maxBound
float :: Real n => n -> Datum Source #
Type generalised Float.
float (1::Int) == float (1::Double) floatRange (undefined::Float) == (-125,128) isInfinite (d_float (float (encodeFloat 1 256 :: Double))) == True
double :: Real n => n -> Datum Source #
Type generalised Double.
double (1::Int) == double (1::Double) double (encodeFloat 1 256 :: Double) == Double 1.157920892373162e77
string :: String -> Datum Source #
AsciiString
of pack.
string "string" == AsciiString (ByteString.Char8.pack "string")
Descriptor
signatureFor :: [Datum] -> String Source #
Message argument types are given by a signature.
signatureFor [Int32 1,Float 1,string "1"] == ",ifs"
descriptor :: [Datum] -> Ascii Source #
The descriptor is an Ascii encoded signature.
descriptor [Int32 1,Float 1,string "1"] == ascii ",ifs"
descriptor_tags :: Ascii -> Ascii Source #
Descriptor tags are comma
prefixed.