]> Git — Sourcephile - tmp/julm/arpeggigon.git/blob - Reactogon/Layer/Layer.hs
Update README.md
[tmp/julm/arpeggigon.git] / Reactogon / Layer / Layer.hs
1 {-# LANGUAGE Arrows #-}
2
3 module Reactogon.Layer.Layer where
4
5 import Reactogon.Beat
6 import Reactogon.Semantics
7 import Reactogon.Global.Clock
8 import FRP.Yampa
9
10 -- Data representing the state of a layer. It is updated continuously.
11 data Layer = Layer { relTempo :: Double
12 , strength :: Strength
13 }
14
15 layerTempo :: SF () Tempo -> SF Layer Tempo
16 layerTempo globalTempo = proc Layer { relTempo = r } -> do
17 t <- tempo -< ()
18 returnA -< floor $ r * fromIntegral t
19
20 layerMetronome :: SF () Tempo -> SF () (Event Beat)
21 layerMetronome tempo = layerTempo tempo >>> metronome
22
23 -- A layer is a producer of events triggered by the system beat clock.
24 layer :: SF () (Event Beat) -> SF Layer (Event Note)
25 layer beatSource = undefined