mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
extract TransportClock
This commit is contained in:
parent
ccc74fd743
commit
85e243f782
6 changed files with 130 additions and 145 deletions
|
|
@ -25,26 +25,34 @@ impl TransportToolbar<Tui> {
|
|||
}
|
||||
fn handle_bpm (&mut self, from: &TuiInput) -> Perhaps<bool> {
|
||||
match from.event() {
|
||||
key!(KeyCode::Char(',')) => { self.bpm -= 1.0; },
|
||||
key!(KeyCode::Char('.')) => { self.bpm += 1.0; },
|
||||
key!(KeyCode::Char('<')) => { self.bpm -= 0.001; },
|
||||
key!(KeyCode::Char('>')) => { self.bpm += 0.001; },
|
||||
key!(KeyCode::Char(',')) => { self.clock.set_bpm(self.clock.bpm() - 1.0); },
|
||||
key!(KeyCode::Char('.')) => { self.clock.set_bpm(self.clock.bpm() + 1.0); },
|
||||
key!(KeyCode::Char('<')) => { self.clock.set_bpm(self.clock.bpm() - 0.001); },
|
||||
key!(KeyCode::Char('>')) => { self.clock.set_bpm(self.clock.bpm() + 0.001); },
|
||||
_ => return Ok(None)
|
||||
}
|
||||
Ok(Some(true))
|
||||
}
|
||||
fn handle_quant (&mut self, from: &TuiInput) -> Perhaps<bool> {
|
||||
match from.event() {
|
||||
key!(KeyCode::Char(',')) => { self.quant = prev_note_length(self.quant); },
|
||||
key!(KeyCode::Char('.')) => { self.quant = next_note_length(self.quant); },
|
||||
key!(KeyCode::Char(',')) => {
|
||||
self.clock.set_quant(prev_note_length(self.clock.quant()));
|
||||
},
|
||||
key!(KeyCode::Char('.')) => {
|
||||
self.clock.set_quant(next_note_length(self.clock.quant()));
|
||||
},
|
||||
_ => return Ok(None)
|
||||
}
|
||||
return Ok(Some(true))
|
||||
}
|
||||
fn handle_sync (&mut self, from: &TuiInput) -> Perhaps<bool> {
|
||||
match from.event() {
|
||||
key!(KeyCode::Char(',')) => { self.sync = prev_note_length(self.sync); },
|
||||
key!(KeyCode::Char('.')) => { self.sync = next_note_length(self.sync); },
|
||||
key!(KeyCode::Char(',')) => {
|
||||
self.clock.set_quant(prev_note_length(self.clock.sync()));
|
||||
},
|
||||
key!(KeyCode::Char('.')) => {
|
||||
self.clock.set_quant(next_note_length(self.clock.sync()));
|
||||
},
|
||||
_ => return Ok(None)
|
||||
}
|
||||
return Ok(Some(true))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue