wip: show single-device chain in launcher

This commit is contained in:
🪞👃🪞 2024-06-24 22:55:24 +03:00
parent 1f194dafd8
commit 2f52e97c58
7 changed files with 315 additions and 239 deletions

View file

@ -14,7 +14,7 @@ pub fn draw (
let height = 32.max(s.note_axis.1 - s.note_axis.0) / 2;
lanes(s, buf, x, y, width);
cursor(s, buf, x, y);
footer(s, buf, x - 13, y, width, height);
footer(s, buf, x, y, width, height);
Ok(Rect {
x: x - 13,
y: y,
@ -25,7 +25,6 @@ pub fn draw (
pub fn timer (s: &Sequencer, buf: &mut Buffer, x: u16, y: u16, beat: usize) {
let bw = Style::default().dim();
let bg = Style::default().on_black();
let (time0, time1) = s.time_axis;
for step in time0..time1 {
buf.set_string(x + 6 + step, y - 1, &"-", if beat % s.steps == step as usize {
@ -38,7 +37,7 @@ pub fn timer (s: &Sequencer, buf: &mut Buffer, x: u16, y: u16, beat: usize) {
pub fn lanes (s: &Sequencer, buf: &mut Buffer, x: u16, y: u16, width: u16) {
let bw = Style::default().dim();
let bg = Style::default().on_black();
let bg = Style::default();
let ppq = s.timebase.ppq() as u32;
let (time0, time1) = s.time_axis;
let notes = &s.sequences[s.sequence].notes;
@ -58,7 +57,7 @@ pub fn lanes (s: &Sequencer, buf: &mut Buffer, x: u16, y: u16, width: u16) {
pub fn footer (s: &Sequencer, buf: &mut Buffer, mut x: u16, y: u16, width: u16, height: u16) {
let bw = Style::default().dim();
let bg = Style::default().on_black();
let bg = Style::default();
let (note0, note1) = s.note_axis;
buf.set_string(x, y + height, format!("{}", "-".repeat((width - 2).into())),
Style::default().dim());
@ -91,8 +90,6 @@ pub fn footer (s: &Sequencer, buf: &mut Buffer, mut x: u16, y: u16, width: u16,
}
pub fn cursor (s: &Sequencer, buf: &mut Buffer, x: u16, y: u16) {
let bw = Style::default().dim();
let bg = Style::default().on_black();
buf.set_string(
x + 6 + s.time_cursor,
y + s.note_cursor / 2,
@ -103,18 +100,17 @@ pub fn cursor (s: &Sequencer, buf: &mut Buffer, x: u16, y: u16) {
pub fn keys (s: &Sequencer, buf: &mut Buffer, mut area: Rect) -> Usually<Rect> {
let bw = Style::default().dim();
let bg = Style::default().on_black();
let Rect { x, y, .. } = area;
let (note0, note1) = s.note_axis;
let (time0, time1) = s.time_axis;
for i in 0..32.max(note1-note0)/2 {
let y = y + i;
buf.set_string(x + 2, y, KEYS_VERTICAL[(i % 6) as usize], bw);
buf.set_string(x + 3, y, "", bw);
buf.set_string(x + 6, y, &"·".repeat((time1 - time0) as usize), bg.dim());
buf.set_string(x + 1, y, KEYS_VERTICAL[(i % 6) as usize], bw);
buf.set_string(x + 2, y, "", bw);
buf.set_string(x + 5, y, &"·".repeat((time1 - time0) as usize), bw.black());
if i % 6 == 0 {
let octave = format!("C{}", ((note1 - i) / 6) as i8 - 4);
buf.set_string(x + 4, y, &octave, Style::default());
buf.set_string(x + 3, y, &octave, Style::default());
}
}
Ok(area)