mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
chore: tidy up
This commit is contained in:
parent
5afed6f055
commit
dc09ea901f
10 changed files with 321 additions and 160 deletions
|
|
@ -66,8 +66,7 @@ impl WidgetRef for Transport {
|
|||
draw_leaf(buf, area, 0, 28, "START");
|
||||
draw_leaf(buf, area, 0, 35, "Project: Witty Gerbil - Sha Na Na ");
|
||||
let position = self.transport.query().expect("failed to query transport");
|
||||
draw_leaf(buf, area, 2, 0, &format!(
|
||||
"BPM {:03}.{:03}",
|
||||
draw_leaf(buf, area, 2, 0, &format!("BPM {:03}.{:03}",
|
||||
self.bpm as u64,
|
||||
((self.bpm % 1.0) * 1000.0) as u64
|
||||
));
|
||||
|
|
@ -75,27 +74,37 @@ impl WidgetRef for Transport {
|
|||
//.with_bpm(self.bpm)
|
||||
//.with_timesig(self.timesig.0, self.timesig.1));
|
||||
//.unwrap();
|
||||
draw_leaf(buf, area, 2, 13, &format!("BBT {}.{}.{}",
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
let rate = position.pos.frame_rate().unwrap();
|
||||
let frame = position.pos.frame();
|
||||
let second = (frame as f64) / (rate as f64);
|
||||
let minute = second / 60f64;
|
||||
let bpm = 120f64;
|
||||
let div = 4;
|
||||
let beats = minute * bpm;
|
||||
let bars = beats as u32 / div as u32;
|
||||
let beat = beats as u32 % div as u32 + 1;
|
||||
let beat_sub = beats % 1.0;
|
||||
//buf.set_string(
|
||||
//area.x - 18, area.y + area.height,
|
||||
//format!("BBT {bars:04}:{beat:02}.{:02}", (beat_sub * 16.0) as u32),
|
||||
//Style::default()
|
||||
//);
|
||||
draw_leaf(buf, area, 2, 13, &format!("BBT {bars:04}:{beat:02}.{:02}",
|
||||
(beat_sub * 16.0) as u32
|
||||
));
|
||||
let rate = position.pos.frame_rate().unwrap();
|
||||
let frame = position.pos.frame();
|
||||
let time = frame as f64 / rate as f64;
|
||||
let seconds = time % 60.0;
|
||||
let msec = seconds % 1.0;
|
||||
let minutes = (time / 60.0) % 60.0;
|
||||
let hours = time / 3600.0;
|
||||
draw_leaf(buf, area, 2, 27, &format!(
|
||||
"Time {:02}:{:02}:{:02}.{:03}",
|
||||
draw_leaf(buf, area, 2, 29, &format!("Time {:02}:{:02}:{:02}.{:03}",
|
||||
hours as u64,
|
||||
minutes as u64,
|
||||
seconds as u64,
|
||||
(msec * 1000.0) as u64
|
||||
));
|
||||
draw_leaf(buf, area, 2, 46, &format!("Rate {:>6}Hz", rate));
|
||||
draw_leaf(buf, area, 2, 61, &format!("Frame {:>12}", frame));
|
||||
draw_leaf(buf, area, 2, 48, &format!("Rate {:>6}Hz", rate));
|
||||
draw_leaf(buf, area, 2, 63, &format!("Frame {:>10}", frame));
|
||||
//Line::from("Project:").render(area, buf);
|
||||
//if let Ok(position) = self.transport.query() {
|
||||
//let frame = position.pos.frame();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue