git ssb

0+

dinoworm ๐Ÿ› / metronome



Tree: de37e989827890621e4dbd2d5a5493b416130606

Files: de37e989827890621e4dbd2d5a5493b416130606 / 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