lanes and grids

This commit is contained in:
🪞👃🪞 2024-06-12 18:38:16 +03:00
parent 788dc1ccde
commit ac865824cc
12 changed files with 213 additions and 112 deletions

View file

@ -205,10 +205,53 @@ const KEYS_VERTICAL: [&'static str; 6] = [
"", "", "", "", "", "",
];
fn render (sequencer: &Sequencer, buf: &mut Buffer, mut area: Rect) {
fn render (sequencer: &Sequencer, buf: &mut Buffer, mut area: Rect)
-> Usually<(u16, u16)>
{
let style = Style::default().gray();
area.height = 18;
//draw_box(buf, area);
let Rect { x, y, width, height } = area;
buf.set_string(x + 1, y + 1, &format!(" │ 00:00.00 / 00:00.00"), style);
buf.set_string(x + 2, y + 1, &format!("{}", &sequencer.name), style.white().bold());
buf.set_string(x + 1, y + 2, &format!(" ▶ PLAY │ ⏹ STOP │ ⏺ REC │ ⏺ DUB "), style);
//buf.set_string(x + 1, y + 6, &format!(" │ Outputs... "), style.dim());
let mut h = 9;
let toggle = true;
if toggle {
for i in 0..16 {
buf.set_string(x + 2, y + 4 + i, &format!(" "), Style::default().on_black());
h = h + 1;
}
}
for i in 0..3 {
buf.set_string(1 + i * 12 + x + 1, y + h - 5, &format!(""), Style::default().white());
buf.set_string(1 + i * 12 + x + 2, y + h - 5, &format!(""), Style::default().black());
buf.set_string(1 + i * 12 + x + 3, y + h - 5, &format!(""), Style::default().white());
buf.set_string(1 + i * 12 + x + 4, y + h - 5, &format!(""), Style::default().black());
buf.set_string(1 + i * 12 + x + 5, y + h - 5, &format!(""), Style::default().white());
buf.set_string(1 + i * 12 + x + 6, y + h - 5, &format!(""), Style::default().white());
buf.set_string(1 + i * 12 + x + 7, y + h - 5, &format!(""), Style::default().black());
buf.set_string(1 + i * 12 + x + 8, y + h - 5, &format!(""), Style::default().white());
buf.set_string(1 + i * 12 + x + 9, y + h - 5, &format!(""), Style::default().black());
buf.set_string(1 + i * 12 + x + 10, y + h - 5, &format!(""), Style::default().white());
buf.set_string(1 + i * 12 + x + 11, y + h - 5, &format!(""), Style::default().black());
buf.set_string(1 + i * 12 + x + 12, y + h - 5, &format!(""), Style::default().white());
buf.set_string(1 + i * 12 + x + 1, y + h - 4, &format!(""), Style::default().white());
buf.set_string(1 + i * 12 + x + 2, y + h -4, &format!(""), Style::default().black());
buf.set_string(1 + i * 12 + x + 3, y + h -4, &format!(""), Style::default().white());
buf.set_string(1 + i * 12 + x + 4, y + h -4, &format!(""), Style::default().black());
buf.set_string(1 + i * 12 + x + 5, y + h -4, &format!(""), Style::default().white());
buf.set_string(1 + i * 12 + x + 6, y + h -4, &format!(""), Style::default().white());
buf.set_string(1 + i * 12 + x + 7, y + h -4, &format!(""), Style::default().black());
buf.set_string(1 + i * 12 + x + 8, y + h -4, &format!(""), Style::default().white());
buf.set_string(1 + i * 12 + x + 9, y + h -4, &format!(""), Style::default().black());
buf.set_string(1 + i * 12 + x + 10, y + h -4, &format!(""), Style::default().white());
buf.set_string(1 + i * 12 + x + 11, y + h -4, &format!(""), Style::default().black());
buf.set_string(1 + i * 12 + x + 12, y + h -4, &format!(""), Style::default().white());
}
draw_box(buf, Rect { x, y, width: 40, height: h - 2 });
Ok((40,h-3))
//{
//let mut area = area.clone();
//area.y = area.y + 3;
@ -223,29 +266,7 @@ fn render (sequencer: &Sequencer, buf: &mut Buffer, mut area: Rect) {
//}
//draw_box(buf, Rect { x, y, width: 18, height });
draw_box(buf, Rect { x, y, width: 40, height: 8 });
draw_box(buf, Rect { x, y, width: 40, height: 6 });
let style = Style::default().gray();
buf.set_string(x + 1, y + 1, &format!(" │ 00:00.00 / 00:00.00"), style);
buf.set_string(x + 2, y + 1, &format!("{}", &sequencer.name), style.bold());
buf.set_string(x + 1, y + 2, &format!(" ▶ PLAY │ ⏹ STOP │ ⏺ REC │ ⏺ DUB "), style);
buf.set_string(x + 0, y + 3, &format!("├--------------------------------------┤"), style.dim());
buf.set_string(x + 1, y + 6, &format!(" Inputs... │ Outputs... "), style);
buf.set_string(x + 0, y + 5, &format!("├--------------------------------------┤"), style.dim());
for i in 0..3 {
buf.set_string(1 + i * 12 + x + 1, y + 4, &format!(" "), Style::default().on_white());
buf.set_string(1 + i * 12 + x + 2, y + 4, &format!(" "), Style::default().on_black());
buf.set_string(1 + i * 12 + x + 3, y + 4, &format!(" "), Style::default().on_white());
buf.set_string(1 + i * 12 + x + 4, y + 4, &format!(" "), Style::default().on_black());
buf.set_string(1 + i * 12 + x + 5, y + 4, &format!(" "), Style::default().on_white());
buf.set_string(1 + i * 12 + x + 6, y + 4, &format!(" "), Style::default().on_white());
buf.set_string(1 + i * 12 + x + 7, y + 4, &format!(" "), Style::default().on_black());
buf.set_string(1 + i * 12 + x + 8, y + 4, &format!(" "), Style::default().on_white());
buf.set_string(1 + i * 12 + x + 9, y + 4, &format!(" "), Style::default().on_black());
buf.set_string(1 + i * 12 + x + 10, y + 4, &format!(" "), Style::default().on_white());
buf.set_string(1 + i * 12 + x + 11, y + 4, &format!(" "), Style::default().on_black());
buf.set_string(1 + i * 12 + x + 12, y + 4, &format!(" "), Style::default().on_white());
}
//draw_box(buf, Rect { x, y, width: 40, height: 8 });
//buf.set_string(x + 1, y + 3,
//&format!(" │ INPUT │ OUTPUT │"),
//Style::default().gray());
@ -259,11 +280,11 @@ fn render (sequencer: &Sequencer, buf: &mut Buffer, mut area: Rect) {
//buf.set_string(x + 54, y + 1, "OUT", Style::default().green().bold());
//}
let mut command = |y2: u16, c: &str, ommand: &str, value: &str| {
buf.set_string(x + 1, y + y2, c, Style::default().bold());
buf.set_string(x + 2, y + y2, ommand, Style::default().dim());
buf.set_string(x + 4 + ommand.len() as u16, y + y2, value, Style::default().bold());
};
//let mut command = |y2: u16, c: &str, ommand: &str, value: &str| {
//buf.set_string(x + 1, y + y2, c, Style::default().bold());
//buf.set_string(x + 2, y + y2, ommand, Style::default().dim());
//buf.set_string(x + 4 + ommand.len() as u16, y + y2, value, Style::default().bold());
//};
//for (y, c, ommand, value) in [
////(5, "I", "nputs", "[+]"),
////(6, "O", "utputs", "[+]"),
@ -308,36 +329,6 @@ fn render (sequencer: &Sequencer, buf: &mut Buffer, mut area: Rect) {
//}
//}
//
let y = y + 8;
draw_box(buf, Rect { x, y: y, width: 40, height: 10 });
buf.set_string(x + 1, y + 1, &format!(" LV2Host#00"), style.bold());
buf.set_string(x + 13, y + 1, &format!("│ Plugin Name"), style.not_dim());
buf.set_string(x + 0, y + 2, &format!("├--------------------------------------┤"), style.dim());
buf.set_string(x + 1, y + 3, &format!(" Parameter 1 0.0"), style);
buf.set_string(x + 1, y + 4, &format!(" Parameter 2 0.0"), style);
buf.set_string(x + 1, y + 5, &format!(" Parameter 3 0.0"), style);
buf.set_string(x + 1, y + 6, &format!(" Parameter 4 0.0"), style);
buf.set_string(x + 0, y + 7, &format!("├--------------------------------------┤"), style.dim());
buf.set_string(x + 1, y + 8, &format!(" Inputs... │ Outputs... "), style);
let y = y + 10;
draw_box(buf, Rect { x, y: y, width: 40, height: 14 });
buf.set_string(x + 1, y + 1, &format!(" Sampler#00 │"), style.bold());
buf.set_string(x + 0, y + 2, &format!("├--------------------------------------┤"), style.dim());
buf.set_string(x + 2, y + 3, &format!("C0 Sample#000"), style.bold());
buf.set_string(x + 2, y + 4, &format!(" {:.03}s",
100000.0/44100.0), style);
buf.set_string(x + 2, y + 5, &format!("C#0 Sample#001"), style.bold());
buf.set_string(x + 2, y + 6, &format!(" {:.03}-{:.03}s",
50000.0/44100.0, 100000.0/44100.0), style);
buf.set_string(x + 2, y + 7, &format!("D0 Sample#002"), style.bold());
buf.set_string(x + 2, y + 8, &format!(" {:.03}-{:.03}/{:.03}s",
0.0, 50000.0/44100.0, 100000.0/44100.0), style);
buf.set_string(x + 2, y + 9, &format!("D#0 Sample#003"), style.bold());
buf.set_string(x + 2, y + 10, &format!(" {:.03}-[{:.03}-{:.03}]/{:.03}s ",
10000.0/44100.0, 25000.0/44100.0, 50000.0/44100.0, 100000.0/44100.0), style);
buf.set_string(x + 0, y + 7 + 4, &format!("├--------------------------------------┤"), style.dim());
buf.set_string(x + 1, y + 7 + 5, &format!(" Inputs... │ Outputs... "), style);
}
fn draw_sequence_button (