1 module Reactogon.Global.Clock ( tempo
6 import Reactogon.Auxiliary.Auxiliary
7 import Reactogon.Semantics
12 tempo :: Tempo -> SF () Tempo
15 -- The initial value is arbitrary but never appears because the switch
17 metronome :: SF Tempo (Event Beat)
18 metronome = switch ((repeatedly (tempoToDTime 60) ())
20 (onChange')) (metronome')
21 where metronome' :: Tempo -> SF Tempo (Event Beat)
22 metronome' t = (switch ((repeatedly (tempoToDTime t) ())
24 onChange) (metronome'))
26 tempoToDTime :: Tempo -> DTime
27 tempoToDTime = (60/) . fromIntegral