mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 20:56:43 +01:00
move formatting onto time traits
This commit is contained in:
parent
f26609ed62
commit
8fb5417c22
4 changed files with 44 additions and 27 deletions
|
|
@ -29,20 +29,13 @@ impl Content for TransportToolbar<Tui> {
|
|||
//"QUANT ", ppq_to_name(self.quant as usize)
|
||||
//})),
|
||||
self.focus.wrap(self.focused, TransportToolbarFocus::Sync, &Outset::X(1u16, row! {
|
||||
"SYNC ", pulses_to_name(self.sync() as usize)
|
||||
"SYNC ", pulses_to_name(self.clock.sync() as usize)
|
||||
}))
|
||||
).align_w().fill_x(),
|
||||
|
||||
self.focus.wrap(self.focused, TransportToolbarFocus::Clock, &{
|
||||
let pulse = self.clock.pulse();
|
||||
let ppq = self.clock.ppq() as usize;
|
||||
let usecs = self.clock.usec();
|
||||
let (beats, pulses) = if ppq > 0 { (pulse / ppq, pulse % ppq) } else { (0, 0) };
|
||||
let (bars, beats) = ((beats / 4) + 1, (beats % 4) + 1);
|
||||
let (seconds, msecs) = (usecs / 1000000, usecs / 1000 % 1000);
|
||||
let (minutes, seconds) = (seconds / 60, seconds % 60);
|
||||
let time1 = format!("{bars}.{beats}.{pulses:02}");
|
||||
let time2 = format!("{minutes}:{seconds:02}:{msecs:03}");
|
||||
let time1 = self.clock.format_current_pulse();
|
||||
let time2 = self.clock.format_current_usec();
|
||||
row!("B" ,time1.as_str(), " T", time2.as_str()).outset_x(1)
|
||||
}).align_e().fill_x(),
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue