]> Git — Sourcephile - tmp/julm/arpeggigon.git/blob - RMCA/tests/testArpeggiated.hs
RMCA/GUI/Board.hs
[tmp/julm/arpeggigon.git] / RMCA / tests / testArpeggiated.hs
1 import FRP.Yampa
2
3 import MIDI
4 import Note
5 import Arpeggiated
6
7 import System.IO
8 import Data.Maybe
9
10 ifReadyDo :: Handle -> IO a -> IO (Maybe a)
11 ifReadyDo hnd x = hReady hnd >>= f
12 where f True = x >>= return . Just
13 f _ = return Nothing
14
15 main :: IO ()
16 main = reactimate initInput sensing output arpeggiated
17
18 initInput = return (110, NoEvent)
19
20 sensing _ = do c <- stdin `ifReadyDo` getChar
21 let c' = if isJust c
22 then Event (NoteOn (toPitch 60) (toVelocity 100))
23 else NoEvent
24 return (1, Just (110,c'))
25
26 output _ x = print x >> return False