]> Git — Sourcephile - tmp/julm/arpeggigon.git/blob - RCMA/Global/Clock.hs
Correction to RV module in Translator and arrowised message functions.
[tmp/julm/arpeggigon.git] / RCMA / Global / Clock.hs
1 module RCMA.Global.Clock ( tempo
2 , metronome
3 , tempoToDTime
4 ) where
5
6 import FRP.Yampa
7 import RCMA.Auxiliary.Auxiliary
8 import RCMA.Semantics
9
10 import Debug.Trace
11
12 tempo :: Tempo -> SF () Tempo
13 tempo = constant
14
15 -- The initial value is arbitrary but never appears because the switch
16 -- is immediate.
17 metronome :: SF Tempo (Event Beat)
18 metronome = switch ((repeatedly (tempoToDTime 60) ())
19 &&&
20 (onChange')) (metronome')
21 where metronome' :: Tempo -> SF Tempo (Event Beat)
22 metronome' t = (switch ((repeatedly (tempoToDTime t) ())
23 &&&
24 onChange) (metronome'))
25
26 tempoToDTime :: Tempo -> DTime
27 tempoToDTime = (15/) . fromIntegral