]> Git — Sourcephile - tmp/julm/arpeggigon.git/blob - RCMA/Global/Clock.hs
Moved Reactogon to RCMA.
[tmp/julm/arpeggigon.git] / RCMA / Global / Clock.hs
1 module Reactogon.Global.Clock ( tempo
2 , metronome
3 , tempoToDTime
4 ) where
5
6 import Reactogon.Auxiliary.Auxiliary
7 import Reactogon.Semantics
8 import FRP.Yampa
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 = (60/) . fromIntegral