hosc-0.15: Haskell Open Sound Control

Safe Haskell | Safe
Language | Haskell98

Sound.OSC.Normalise

Contents

- Coercion
- Promotion

Description

Datum normalisation.

Synopsis

- normalise_datum :: Datum -> Datum
- normalise_message :: Message -> Message
- normalise_bundle :: Bundle -> Bundle
- message_coerce :: (Datum -> Datum) -> Message -> Message
- bundle_coerce :: (Datum -> Datum) -> Bundle -> Bundle
- datum_promote :: Datum -> Datum
- datum_floor :: Datum -> Datum

# Documentation

normalise_datum :: Datum -> Datum Source #

Lift `Int32` to `Int64` and `Float` to `Double`.

    map normalise_datum [Int32 1,Float 1] == [Int64 1,Double 1]

normalise_message :: Message -> Message Source #

A normalised `Message` has only `Int64` and `Double` numerical values.

    let m = message "/m" [Int32 0,Float 0]
    in normalise_message m == message "/m" [Int64 0,Double 0]

normalise_bundle :: Bundle -> Bundle Source #

A normalised `Bundle` has only `Int64` and `Double` numerical values.

# Coercion

message_coerce :: (Datum -> Datum) -> Message -> Message Source #

Map a normalising function over datum at an OSC `Message`.

bundle_coerce :: (Datum -> Datum) -> Bundle -> Bundle Source #

Map a normalising function over datum at an OSC `Bundle`.

# Promotion

datum_promote :: Datum -> Datum Source #

Coerce `Int32`, `Int64` and `Float` to `Double`.

    map datum_promote [Int32 5,Float 5] == [Double 5,Double 5]

datum_floor :: Datum -> Datum Source #

`Datum` as `Int64` if `Int32`, `Int64`, `Float` or `Double`.

    let d = [Int32 5,Int64 5,Float 5.5,Double 5.5,string "5"]
    in map datum_floor d == [Int64 5,Int64 5,Int64 5,Int64 5,string "5"]