From 3c4d35d9f88ae2f1139d0f402c05132bf7e3ec81 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Thu, 3 Dec 2015 07:20:30 -0500 Subject: record tick time in input history --- midi-dump.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'midi-dump.hs') diff --git a/midi-dump.hs b/midi-dump.hs index b345531..b3698ae 100644 --- a/midi-dump.hs +++ b/midi-dump.hs @@ -13,9 +13,12 @@ main = main' `AlsaExc.catch` handler where handler e = putStrLn $ "alsa_exception: " ++ AlsaExc.show e +data EVENT = EVENT TimeSpec Event.T + deriving Show + data LoopState = LoopState { keysDown :: MidiPitchSet, - inputHistory :: [Maybe Event.T], + inputHistory :: [Maybe EVENT], lastTick :: TimeSpec } @@ -42,7 +45,7 @@ loop = do else do now <- liftIO $ getTime Monotonic let delta = now - startTime - let newEvents = map Just events + let newEvents = map (Just . (EVENT now)) events liftIO $ printChordLn newKeys modify $ \s -> s { keysDown = newKeys, inputHistory = newEvents ++ inputHistory s } -- cgit v1.2.3