1 {-# LANGUAGE ScopedTypeVariables #-}
5 import Control.Concurrent
6 import Data.ReactiveValue
9 import RMCA.Auxiliary.Concurrent
10 import RMCA.Auxiliary.RV
11 import RMCA.Auxiliary.RV
12 import RMCA.Global.Clock
13 import RMCA.Layer.Board
14 import RMCA.Layer.Layer
16 import RMCA.Translator.Jack
17 import RMCA.Translator.Message
18 import RMCA.Translator.Translator
23 boardRVIO = newCBMVarRW $
24 makeBoard [((0,0), mkCell (ChDir False na1 N)),
25 ((0,1), mkCell (ChDir True na1 SE)),
26 ((1,1), mkCell (Split na1)),
27 ((1,-1), mkCell (Split na1)),
28 ((-1,0), mkCell (ChDir False na2 NE))]
33 naOrn = Ornaments Nothing [] NoSlide
39 naOrn = Ornaments Nothing [(10, MIDICVRnd)] SlideUp
45 naOrn = Ornaments Nothing [] NoSlide
52 tempoRV :: ReactiveFieldReadWrite IO Tempo
53 tempoRV = ReactiveFieldReadWrite (\_ -> return ()) (return 96) (\_ -> return ())
57 layerRV <- getDefaultLayerRV
59 layer <- reactiveValueRead layerRV
60 tempo <- reactiveValueRead tempoRV
62 board <- reactiveValueRead boardRV
63 (inBoard, outBoard) <- yampaReactiveDual (board, layer, tempo) (boardSF $ startHeads board)
64 let inRV = liftRW2 (bijection (\(x,y,z) -> (x,(y,z)), \(x,(y,z)) -> (x,y,z)))
65 boardRV $ pairRW layerRV tempoRV
66 clock <- mkClockRV 100
69 --reactiveValueOnCanRead outBoard (reactiveValueRead outBoard >>= print . ("Board out " ++) . show)
71 --reactiveValueOnCanRead outBoard (reactiveValueRead outBoard >>= print)
72 putStrLn "Board started."
74 jackSetup (liftR2 (\t n -> (t, 0, event [] id n)) tempoRV outBoard)
77 {-jackT <- forkChild $ jackSetup (liftR2 (\t n -> (t, 0, n)) tempoRV