Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

dont bundle messages and send message timestamps as unix time

  • Loading branch information...
commit a8195d1a5fcbdc6fa3c5cad6826c2f14b01865ba 1 parent 2586ccc
@yaxu authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 Stream.hs
View
10 Stream.hs
@@ -13,6 +13,7 @@ import Pattern
import Data.Ratio
--import Control.Exception
import Parse
+import Debug.Trace
import qualified Data.Map as Map
@@ -67,7 +68,7 @@ isSubset xs ys = all (\x -> elem x ys) xs
tpb = 1
-toMessage :: OscShape -> BpsChange -> Int -> (Double, OscMap) -> Maybe Bundle
+toMessage :: OscShape -> BpsChange -> Int -> (Double, OscMap) -> Maybe Message
toMessage s change ticks (o, m) =
do m' <- applyShape' s m
let beat = fromIntegral ticks / fromIntegral tpb
@@ -75,13 +76,14 @@ toMessage s change ticks (o, m) =
logicalNow = (logicalTime change beat)
beat' = (fromIntegral ticks + 1) / fromIntegral tpb
logicalPeriod = (logicalTime change (beat + 1)) - logicalNow
- logicalOnset = logicalNow + (logicalPeriod * o) + latency
+ logicalOnset = ntpr_to_ut $ logicalNow + (logicalPeriod * o) + latency
sec = floor logicalOnset
usec = floor $ 1000000 * (logicalOnset - (fromIntegral sec))
oscdata = catMaybes $ mapMaybe (\x -> Map.lookup x m') (params s)
oscdata' = ((Int sec):(Int usec):oscdata)
- osc | timestamp s = Bundle (immediately) [Message (path s) oscdata']
- | otherwise = Bundle (ut_to_ntpr logicalOnset) [Message (path s) oscdata]
+ osc | timestamp s = Message (path s) oscdata'
+ | otherwise = Message (path s) oscdata
+ -- | otherwise = Bundle (ut_to_ntpr logicalOnset) [Message (path s) oscdata]
return osc
Please sign in to comment.
Something went wrong with that request. Please try again.