module Sound.SC3.Server.NRT ( encodeNRT
, writeNRT
, putNRT ) where
import qualified Data.ByteString.Lazy as B
import Sound.OpenSoundControl
import System.IO
oscWithSize :: OSC -> B.ByteString
oscWithSize o = B.append l b
where b = encodeOSCNTP o
l = encode_i32 (fromIntegral (B.length b))
encodeNRT :: [OSC] -> B.ByteString
encodeNRT s = B.concat (map oscWithSize s)
writeNRT :: FilePath -> [OSC] -> IO ()
writeNRT fn s = B.writeFile fn (encodeNRT s)
putNRT :: Handle -> [OSC] -> IO ()
putNRT h s = B.hPut h (encodeNRT s)