1 module RCMA.Global.Clock ( tempo
7 import RCMA.Auxiliary.Auxiliary
10 tempo :: Tempo -> SF () Tempo
13 -- The initial value is arbitrary but never appears because the switch
15 metronome :: SF Tempo (Event Beat)
16 metronome = switch ((repeatedly (tempoToDTime 60) ())
18 (onChange')) (metronome')
19 where metronome' :: Tempo -> SF Tempo (Event Beat)
20 metronome' t = (switch ((repeatedly (4 * tempoToDTime t) ())
22 onChange) (metronome'))
24 -- Tempo is the number of whole notes per minute.
25 tempoToDTime :: Tempo -> DTime
26 tempoToDTime = (15/) . fromIntegral