-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Open Sound Control encode/decode
--   
--   A small, simple, and well-tested implementation of the Open Sound
--   Control message format.
--   
--   Example usage:
--   
--   <pre>
--   {-# LANGUAGE OverloadedStrings #-}
--   </pre>
--   
--   <pre>
--   import Network.Socket
--   import Network.Socket.ByteString as SB
--   
--   import Vivid.OSC
--   
--   main = do
--      -- Boring Network.Socket setup:
--      (a:_) &lt;- getAddrInfo Nothing (Just "127.0.0.1") (Just "57120")
--      s &lt;- socket (addrFamily a) Datagram defaultProtocol
--      connect s (addrAddress a)
--   
--      -- The interesting part:
--      SB.send s $ encodeOSC $
--         OSC "/play2" [OSC_S "cps", OSC_I 1, OSC_S "s", OSC_S "bd"]
--   </pre>
@package vivid-osc
@version 0.3.0.0


-- | Open Sound Control data
module Vivid.OSC

-- | An OSC message, e.g.
--   
--   <pre>
--   OSC "/n_free" [OSC_I 42]
--   </pre>
data OSC
OSC :: ByteString -> [OSCDatum] -> OSC
data OSCDatum
OSC_I :: Int32 -> OSCDatum
OSC_S :: ByteString -> OSCDatum
OSC_F :: Float -> OSCDatum

-- | This isn't a base type in the OSC standard but the scsynth response
--   message from "/status" uses it...
OSC_D :: Double -> OSCDatum
OSC_B :: ByteString -> OSCDatum

-- | From the OSC 1.1 spec
OSC_T :: Timestamp -> OSCDatum
encodeOSC :: OSC -> ByteString
decodeOSC :: ByteString -> Either String OSC

-- | This is stored as the number of seconds since Jan 1 1900. You can get
--   it with <a>getTime</a>
newtype Timestamp
Timestamp :: Double -> Timestamp

-- | TODO: a Bundle can also contain other bundles, recursively
data OSCBundle
OSCBundle :: Timestamp -> [Either ByteString OSC] -> OSCBundle
encodeOSCBundle :: OSCBundle -> ByteString
decodeOSCBundle :: ByteString -> Either String OSCBundle
encodeTimestamp :: Timestamp -> ByteString
utcToTimestamp :: UTCTime -> Timestamp
addSecs :: Timestamp -> Double -> Timestamp
diffTimestamps :: Timestamp -> Timestamp -> Double
encodeOSCDatum :: OSCDatum -> ByteString
putOSC :: OSC -> Put
putOSCString :: ByteString -> Put
putOSCDatum :: OSCDatum -> Put
getOSCString :: Get ByteString
getOSC :: Get OSC
putOSCBlob :: ByteString -> Put
getOSCBlob :: Get ByteString
getOSCTimestamp :: Get Timestamp
putOSCTimestamp :: Timestamp -> Put
putOSCBundle :: OSCBundle -> Put
getOSCBundle :: Get OSCBundle
runGetWithNoLeftover :: Get a -> ByteString -> Either String a
toTypeChar :: OSCDatum -> ByteString
alignTo4' :: Integral i => i -> i
instance GHC.Classes.Eq Vivid.OSC.OSCBundle
instance GHC.Read.Read Vivid.OSC.OSCBundle
instance GHC.Show.Show Vivid.OSC.OSCBundle
instance GHC.Classes.Ord Vivid.OSC.OSC
instance GHC.Classes.Eq Vivid.OSC.OSC
instance GHC.Read.Read Vivid.OSC.OSC
instance GHC.Show.Show Vivid.OSC.OSC
instance GHC.Classes.Ord Vivid.OSC.OSCDatum
instance GHC.Classes.Eq Vivid.OSC.OSCDatum
instance GHC.Read.Read Vivid.OSC.OSCDatum
instance GHC.Show.Show Vivid.OSC.OSCDatum
instance GHC.Classes.Ord Vivid.OSC.Timestamp
instance GHC.Classes.Eq Vivid.OSC.Timestamp
instance GHC.Read.Read Vivid.OSC.Timestamp
instance GHC.Show.Show Vivid.OSC.Timestamp

module Vivid.OSC.Old.Util
align :: (Num i, Bits i) => i -> i
floatToWord :: Float -> Word32
wordToFloat :: Word32 -> Float
doubleToWord :: Double -> Word64
wordToDouble :: Word64 -> Double


-- | An older implementation of the spec. I provide it here, and several
--   tests, to show that the new code behaves the same. Will be removed
--   soon.
module Vivid.OSC.Old
encodeOSC :: OSC -> ByteString
encodeOSCDatum :: OSCDatum -> ByteString
encodeOSCBundle :: OSCBundle -> ByteString
encodeTimestamp :: Timestamp -> ByteString
encodedOSC_addLength :: ByteString -> ByteString
decodeOSCData :: [Char] -> ByteString -> Either String [OSCDatum]
decodeOSC :: ByteString -> Either String OSC
decodeOSCDatumWithPadding :: Char -> ByteString -> Either String OSCDatum
