git ssb

0+

dinoworm ๐Ÿ› / metronome



Tree: f675cb27f2640ba304b1816b279b2ef7f8c19a59

Files: f675cb27f2640ba304b1816b279b2ef7f8c19a59 / src / main.rs

1016 bytesRaw
1extern crate ncurses;
2
3mod clock;
4mod control;
5mod interface;
6
7fn main () {
8 Metronome::run(60_f64);
9}
10
11
12pub type Bpm = f64;
13
14struct Metronome {
15 pub bpm: Bpm
16}
17
18impl Metronome {
19 pub fn run (bpm: Bpm) {
20 let control = control::Control::new();
21
22 let clock_signature = clock::ClockSignature::new(bpm);
23
24 let clock = clock::Clock::start(clock_signature, control.tx.clone());
25 let terminal_interface = interface::TerminalInterface::start(clock_signature, control.tx.clone());
26
27 for control_message in control.rx {
28 match control_message {
29 control::ControlMessage::Signature(signature) => {
30 terminal_interface.tx.send(interface::InterfaceMessage::Signature(signature)).unwrap();
31 },
32 control::ControlMessage::Time(time) => {
33 terminal_interface.tx.send(interface::InterfaceMessage::Time(time)).unwrap();
34 },
35 _ => {}
36 }
37 }
38 }
39}
40
41

Built with git-ssb-web