-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell Open Sound Control -- -- hosc provides Sound.OpenSoundControl, a haskell module implementing a -- subset of the Open Sound Control byte protocol. @package hosc @version 0.8 -- | Bit-level type casts and byte layout string typecasts. module Sound.OpenSoundControl.Cast -- | The IEEE byte representation of a float packed into an integer. f32_i32 :: Float -> Int32 -- | Inverse of f32_i32. i32_f32 :: Int32 -> Float -- | The IEEE byte representation of a double packed into an integer. f64_i64 :: Double -> Int64 -- | Inverse of f64_i64. i64_f64 :: Int64 -> Double -- | Transform a haskell string into a C string (a null suffixed byte -- string). str_cstr :: String -> [Word8] -- | Inverse of str_cstr. cstr_str :: [Word8] -> String -- | Transform a haskell string to a pascal string (a length prefixed byte -- string). str_pstr :: String -> [Word8] -- | Inverse of str_pstr. pstr_str :: [Word8] -> String -- | Byte-level encoding and decoding functions. module Sound.OpenSoundControl.Byte -- | Encode a signed 8-bit integer. encode_i8 :: Int -> ByteString -- | Encode a signed 16-bit integer. encode_i16 :: Int -> ByteString -- | Encode a signed 32-bit integer. encode_i32 :: Int -> ByteString -- | Encode an unsigned 16-bit integer. encode_u32 :: Int -> ByteString -- | Encode a signed 64-bit integer. encode_i64 :: Integer -> ByteString -- | Encode an unsigned 64-bit integer. encode_u64 :: Integer -> ByteString -- | Encode a 32-bit IEEE floating point number. encode_f32 :: Double -> ByteString -- | Encode a 64-bit IEEE floating point number. encode_f64 :: Double -> ByteString -- | Encode an ASCII string. encode_str :: String -> ByteString -- | Decode a signed 8-bit integer. decode_i8 :: ByteString -> Int -- | Decode a signed 16-bit integer. decode_i16 :: ByteString -> Int -- | Decode a signed 32-bit integer. decode_i32 :: ByteString -> Int -- | Decode an unsigned 32-bit integer. decode_u32 :: ByteString -> Int -- | Decode a signed 64-bit integer. decode_i64 :: ByteString -> Integer -- | Decode an unsigned 64-bit integer. decode_u64 :: ByteString -> Integer -- | Decode a 32-bit IEEE floating point number. decode_f32 :: ByteString -> Double -- | Decode a 64-bit IEEE floating point number. decode_f64 :: ByteString -> Double -- | Decode an ASCII string. decode_str :: ByteString -> String -- | Temporal representations and clock operations (read current time and -- pause thread). module Sound.OpenSoundControl.Time -- | Time is represented in either UTC or NTP form. data Time UTCr :: Double -> Time NTPr :: Double -> Time NTPi :: Integer -> Time -- | Coerce to NTPi form. as_ntpi :: Time -> Integer -- | Coerce to UTCr form. as_utcr :: Time -> Double -- | Convert a real-valued NTP timestamp to an NTP timestamp. ntpr_ntpi :: Double -> Integer -- | Convert an NTP timestamp to a real-valued NTP timestamp. ntpi_ntpr :: Integer -> Double -- | Convert UTC timestamp to NTP timestamp. utcr_ntpi :: Double -> Integer -- | Convert NTP timestamp to UTC timestamp. ntpr_utcr :: Double -> Double -- | Convert NTP timestamp to UTC timestamp. ntpi_utcr :: Integer -> Double -- | The time at 1970-01-01:00:00:00. utc_base :: UTCTime -- | Read current UTCr timestamp. utcr :: IO Double -- | Read current NTP timestamp. ntpi :: IO Integer -- | Pause current thread for the indicated duration, given in seconds. pauseThread :: Double -> IO () -- | Pause current thread until the given utcr time. pauseThreadUntil :: Double -> IO () -- | Execute the bundle immediately. immediately :: Time instance Eq Time instance Show Time instance Ord Time -- | Alegbraic data types for OSC packets and encode and decode functions. module Sound.OpenSoundControl.OSC -- | An OSC packet. data OSC Message :: String -> [Datum] -> OSC Bundle :: Time -> [OSC] -> OSC -- | The basic elements of OSC messages. data Datum Int :: Int -> Datum Float :: Double -> Datum Double :: Double -> Datum String :: String -> Datum Blob :: [Word8] -> Datum TimeStamp :: Time -> Datum -- | Encode an OSC packet. encodeOSC :: OSC -> ByteString -- | Decode an OSC packet. decodeOSC :: ByteString -> OSC instance Eq OSC instance Show OSC instance Eq Datum instance Show Datum instance Ord OSC -- | An abstract transport layer with implementations for UDP and TCP -- transport. module Sound.OpenSoundControl.Transport -- | Abstract over the underlying transport protocol. class Transport t send :: Transport t => t -> OSC -> IO () recv :: Transport t => t -> IO OSC close :: Transport t => t -> IO () -- | Bracket OSC communication. withTransport :: Transport t => IO t -> (t -> IO a) -> IO a -- | Wait for an OSC message where the supplied function does not give -- Nothing, discarding intervening messages. waitFor :: Transport t => t -> (OSC -> Maybe a) -> IO a -- | A waitFor for variant matching on address string of messages. wait :: Transport t => t -> String -> IO OSC -- | OSC over UDP implementation. module Sound.OpenSoundControl.Transport.UDP -- | The UDP transport handle data type. data UDP -- | Make a UDP connection. openUDP :: String -> Int -> IO UDP -- | Trivial udp server. udpServer :: String -> Int -> IO UDP udpPort :: Integral n => UDP -> IO n sendTo :: UDP -> OSC -> SockAddr -> IO () recvFrom :: UDP -> IO (OSC, SockAddr) instance Eq UDP instance Show UDP instance Transport UDP -- | OSC over TCP implementation. module Sound.OpenSoundControl.Transport.TCP -- | The TCP transport handle data type. data TCP -- | Make a TCP connection. openTCP :: String -> Int -> IO TCP -- | A trivial TCP OSC server. tcpServer :: Int -> (TCP -> IO ()) -> IO () instance Eq TCP instance Show TCP instance Transport TCP -- | OSC packet coercion and normalization. module Sound.OpenSoundControl.Coerce -- | Map a normalizing function over datum at an osc packet. coerce :: (Datum -> Datum) -> OSC -> OSC -- | Coerce Float to Double. f_to_d :: Datum -> Datum -- | Coerce Int and Float to Double. if_to_d :: Datum -> Datum -- | Coerce Float and Double to Int. fd_to_i :: Datum -> Datum -- | A normalized osc packet has only Int and Double numerical values. normalize :: OSC -> OSC -- | hosc implements a subset of the Open Sound Control byte protocol. The -- protocol is documented at http://opensoundcontrol.org/. module Sound.OpenSoundControl