wip: long awaited fixes to main sequencer

This commit is contained in:
🪞👃🪞 2024-07-01 04:20:41 +03:00
parent 2837ffff4a
commit 78e5469b32
17 changed files with 391 additions and 563 deletions

View file

@ -10,13 +10,13 @@ pub fn draw (
area.x = area.x + 13;
let Rect { x, y, width, .. } = area;
keys(buf, area, s.note_axis.1)?;
timer(buf, x + 6, y - 1, beat, s.steps, s.time_axis.0, s.time_axis.1);
timer(buf, x+6, y-1, s.time_axis.0, s.time_axis.1, beat as u16);
let height = 32.max(s.note_axis.1 - s.note_axis.0) / 2;
if let Some(phrase) = s.phrase() {
lanes(buf, x, y,
phrase,
s.timebase.ppq() as u32,
s.resolution as u32,
s.time_zoom as u32,
s.time_axis.0 as u32,
s.time_axis.1 as u32,
s.note_axis.0 as u32,
@ -36,9 +36,9 @@ pub fn draw (
})
}
pub fn timer (buf: &mut Buffer, x: u16, y: u16, beat: usize, steps: usize, time0: u16, time1: u16) {
pub fn timer (buf: &mut Buffer, x: u16, y: u16, time0: u16, time1: u16, now: u16) {
for step in time0..time1 {
buf.set_string(x + step, y, &"-", if beat % steps == step as usize {
buf.set_string(x + step, y, &"-", if step == now {
Style::default().yellow().bold().not_dim()
} else {
Style::default()
@ -123,7 +123,7 @@ pub fn footer (s: &Sequencer, buf: &mut Buffer, mut x: u16, y: u16, width: u16,
{
for (_, [letter, title, value]) in [
["S", &format!("ync"), &format!("<4/4>")],
["Q", &format!("uant"), &format!("<1/{}>", 4 * s.resolution)],
["Q", &format!("uant"), &format!("<1/{}>", 4 * s.time_zoom)],
["N", &format!("ote"), &format!("{} ({}-{})",
s.note_axis.0 + s.note_cursor,
s.note_axis.0,