diff --git a/src/device/sequencer/horizontal.rs b/src/device/sequencer/horizontal.rs index b0a99a0a..5fd59634 100644 --- a/src/device/sequencer/horizontal.rs +++ b/src/device/sequencer/horizontal.rs @@ -54,28 +54,49 @@ pub fn keys (s: &Sequencer, buf: &mut Buffer, mut area: Rect) -> Usually { } pub fn lanes (s: &Sequencer, buf: &mut Buffer, x: u16, y: u16, width: u16) { - let bw = Style::default().dim(); let bg = Style::default(); + let bw = bg.dim(); + let wh = bg.white(); let ppq = s.timebase.ppq() as u32; let (time0, time1) = s.time_axis; + let (note0, note1) = s.note_axis; let notes = &s.sequences[s.sequence].notes; for step in time0..time1 { - let time_start = step as u32 * ppq; - let time_end = (step + 1) as u32 * ppq; + let (a, b) = ( + (step + 0) as u32 * ppq / s.resolution as u32, + (step + 1) as u32 * ppq / s.resolution as u32, + ); if step % s.resolution as u16 == 0 { - buf.set_string(x + 6 + step, y - 1, &format!("{}", step + 1), Style::default()); + buf.set_string(x + 5 + step, y - 1, &format!("{}", step + 1), Style::default()); } - for (_, (_, events)) in notes.range(time_start..time_end).enumerate() { - if events.len() > 0 { - buf.set_string(x + 6 + step as u16, y, "█", bw); - } + for k in 0..(note1 - note0)/2 { + let (character, style) = match ( + contains_note_on(&s.sequences[s.sequence], + ::midly::num::u7::from_int_lossy((note0 + k * 2 + 0) as u8), + a, b), + contains_note_on(&s.sequences[s.sequence], + ::midly::num::u7::from_int_lossy((note0 + k * 2 + 1) as u8), + a, b), + ) { + (true, true) => ("█", wh), + (true, false) => ("▀", wh), + (false, true) => ("▄", wh), + (false, false) => ("·", bw), + }; + //let (character, style) = ("▄", bg); + buf.set_string(x + 5 + step, y + k, character, style); } + //for (_, (_, events)) in notes.range(time_start..time_end).enumerate() { + //if events.len() > 0 { + //buf.set_string(x + 6 + step as u16, y, "█", wh); + //} + //} } } pub fn cursor (s: &Sequencer, buf: &mut Buffer, x: u16, y: u16) { buf.set_string( - x + 6 + s.time_cursor, + x + 5 + s.time_cursor, y + s.note_cursor / 2, if s.note_cursor % 2 == 0 { "▀" } else { "▄" }, Style::default().green().not_dim() diff --git a/src/device/sequencer/vertical.rs b/src/device/sequencer/vertical.rs index d7751511..5a205d73 100644 --- a/src/device/sequencer/vertical.rs +++ b/src/device/sequencer/vertical.rs @@ -19,8 +19,9 @@ pub fn draw ( pub fn steps (s: &Sequencer, buf: &mut Buffer, area: Rect, beat: usize) { let ppq = s.timebase.ppq() as u32; - let bw = Style::default().dim().on_black(); - let bg = Style::default().on_black(); + let bg = Style::default(); + let bw = bg.dim(); + let wh = bg.white(); let Rect { x, y, .. } = area; let (time0, time1) = s.time_axis; let (note0, note1) = s.note_axis; @@ -43,9 +44,9 @@ pub fn steps (s: &Sequencer, buf: &mut Buffer, area: Rect, beat: usize) { contains_note_on(&s.sequences[s.sequence], key, a, b), contains_note_on(&s.sequences[s.sequence], key, b, c), ) { - (true, true) => ("█", bg), - (true, false) => ("▀", bg), - (false, true) => ("▄", bg), + (true, true) => ("█", wh), + (true, false) => ("▀", wh), + (false, true) => ("▄", wh), (false, false) => ("·", bw), }; buf.set_string(x + 5 + k - note0, y, character, style);