mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
lanes and grids
This commit is contained in:
parent
788dc1ccde
commit
ac865824cc
12 changed files with 213 additions and 112 deletions
|
|
@ -5,11 +5,10 @@ pub struct Transport {
|
|||
transport: Option<::jack::Transport>,
|
||||
bpm: f64,
|
||||
timesig: (f32, f32),
|
||||
devices: Vec<Box<dyn Device>>,
|
||||
}
|
||||
|
||||
impl Transport {
|
||||
pub fn new (devices: Vec<Box<dyn Device>>)
|
||||
pub fn new ()
|
||||
-> Result<DynamicDevice<Self>, Box<dyn Error>>
|
||||
{
|
||||
//let transport = client.transport();
|
||||
|
|
@ -18,7 +17,6 @@ impl Transport {
|
|||
bpm: 113.0,
|
||||
timesig: (4.0, 4.0),
|
||||
transport: None,
|
||||
devices
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
@ -42,14 +40,20 @@ impl Transport {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn render (state: &Transport, buf: &mut Buffer, area: Rect) {
|
||||
draw_leaf(buf, area, 0, 0, "REC");
|
||||
draw_leaf(buf, area, 0, 5, "DUB");
|
||||
draw_leaf(buf, area, 0, 10, "STOP");
|
||||
draw_leaf(buf, area, 0, 16, "PLAY/PAUSE");
|
||||
draw_leaf(buf, area, 0, 28, "START");
|
||||
draw_leaf(buf, area, 0, 35, "Project: Witty Gerbil - Sha Na Na ");
|
||||
draw_leaf(buf, area, 2, 0, &format!("BPM {:03}.{:03}",
|
||||
pub fn render (state: &Transport, buf: &mut Buffer, mut area: Rect)
|
||||
-> Usually<(u16, u16)>
|
||||
{
|
||||
area.x = area.width.saturating_sub(80) / 2;
|
||||
area.width = area.width.min(80);
|
||||
area.height = 5;
|
||||
draw_box(buf, area);
|
||||
draw_leaf(buf, area, 1, 0, "REC");
|
||||
draw_leaf(buf, area, 1, 5, "DUB");
|
||||
draw_leaf(buf, area, 1, 10, "STOP");
|
||||
draw_leaf(buf, area, 1, 16, "PLAY/PAUSE");
|
||||
draw_leaf(buf, area, 1, 28, "START");
|
||||
draw_leaf(buf, area, 1, 35, "Project: Witty Gerbil - Sha Na Na ");
|
||||
draw_leaf(buf, area, 3, 0, &format!("BPM {:03}.{:03}",
|
||||
state.bpm as u64,
|
||||
((state.bpm % 1.0) * 1000.0) as u64
|
||||
));
|
||||
|
|
@ -70,23 +74,24 @@ pub fn render (state: &Transport, buf: &mut Buffer, area: Rect) {
|
|||
//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}",
|
||||
draw_leaf(buf, area, 3, 13, &format!("BBT {bars:04}:{beat:02}.{:02}",
|
||||
(beat_sub * 16.0) as u32
|
||||
));
|
||||
let time = frame as f64 / rate as f64;
|
||||
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, 29, &format!("Time {:02}:{:02}:{:02}.{:03}",
|
||||
draw_leaf(buf, area, 3, 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, 48, &format!("Rate {:>6}Hz", rate));
|
||||
draw_leaf(buf, area, 2, 63, &format!("Frame {:>10}", frame));
|
||||
draw_leaf(buf, area, 3, 48, &format!("Rate {:>6}Hz", rate));
|
||||
draw_leaf(buf, area, 3, 63, &format!("Frame {:>10}", frame));
|
||||
}
|
||||
Ok((area.width, area.height))
|
||||
//let bbt = position.pos.bbt().map(|mut bbt|*bbt
|
||||
//.with_bpm(state.bpm)
|
||||
//.with_timesig(state.timesig.0, state.timesig.1));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue