make TimeUnit a trait

This commit is contained in:
🪞👃🪞 2024-11-02 01:03:23 +02:00
parent a31d6389be
commit 4df15d6bac
7 changed files with 238 additions and 220 deletions

View file

@ -24,7 +24,7 @@ impl TransportToolbar<Tui> {
Ok(Some(true))
}
fn handle_bpm (&mut self, from: &TuiInput) -> Perhaps<bool> {
let bpm = self.clock.timebase().bpm().get();
let bpm = self.clock.timebase().bpm.get();
match from.event() {
key!(KeyCode::Char(',')) => { self.clock.timebase().bpm.set(bpm - 1.0); },
key!(KeyCode::Char('.')) => { self.clock.timebase().bpm.set(bpm + 1.0); },
@ -35,7 +35,7 @@ impl TransportToolbar<Tui> {
Ok(Some(true))
}
fn handle_quant (&mut self, from: &TuiInput) -> Perhaps<bool> {
let quant = self.clock.quant().get() as usize;
let quant = self.clock.quant.get() as usize;
match from.event() {
key!(KeyCode::Char(',')) => { self.clock.quant.set(prev_note_length(quant) as f64); },
key!(KeyCode::Char('.')) => { self.clock.quant.set(next_note_length(quant) as f64); },
@ -44,7 +44,7 @@ impl TransportToolbar<Tui> {
return Ok(Some(true))
}
fn handle_sync (&mut self, from: &TuiInput) -> Perhaps<bool> {
let sync = self.clock.sync().get() as usize;
let sync = self.clock.sync.get() as usize;
match from.event() {
key!(KeyCode::Char(',')) => { self.clock.quant.set(prev_note_length(sync) as f64); },
key!(KeyCode::Char('.')) => { self.clock.quant.set(next_note_length(sync) as f64); },