fbpr: show note tails and octave separators (both misaligned)

This commit is contained in:
🪞👃🪞 2024-12-06 15:18:23 +01:00
parent d06ae94655
commit ed7f96baca

View file

@ -328,28 +328,18 @@ impl PhraseViewMode {
fn draw_piano_horizontal ( fn draw_piano_horizontal (
target: &mut BigBuffer, phrase: &Phrase, time_zoom: usize, _: usize target: &mut BigBuffer, phrase: &Phrase, time_zoom: usize, _: usize
) { ) {
//cell.set_char(if ppq == 0 {
//'·'
//} else if x % (4 * ppq) == 0 {
//'│'
//} else if x % ppq == 0 {
//'╎'
//} else {
//'·'
//});
//cell.set_fg(Color::Rgb(48, 64, 56));
let style = Style::default().fg(Color::Rgb(255, 255, 255)); let style = Style::default().fg(Color::Rgb(255, 255, 255));
let mut notes_on = [false;128]; let mut notes_on = [false;128];
for (y, note) in (0..127).rev().enumerate() { for (y, note) in (0..127).rev().enumerate() {
for (x, time) in (0..target.width).map(|x|(x, x*time_zoom)) { for (x, time) in (0..target.width).map(|x|(x, x*time_zoom)) {
let cell = target.get_mut(x, y).unwrap(); let cell = target.get_mut(x, y).unwrap();
cell.set_fg(Color::Rgb(38, 45, 35)); cell.set_fg(Color::Rgb(48, 55, 45));
cell.set_char(if time % 384 == 0 { cell.set_char(if time % 384 == 0 {
'│' '│'
} else if time % 96 == 0 { } else if time % 96 == 0 {
'╎' '╎'
} else if note % 12 == 0 { } else if note % 12 == 0 {
'-' '='
} else { } else {
'·' '·'
}); });
@ -358,15 +348,13 @@ impl PhraseViewMode {
for (x, time_start) in (0..phrase.length).step_by(time_zoom).enumerate() { for (x, time_start) in (0..phrase.length).step_by(time_zoom).enumerate() {
let time_end = time_start + time_zoom; let time_end = time_start + time_zoom;
for time in time_start..time_end { for time in time_start..time_end {
for (y, note) in (127..0).enumerate() { for (y, note) in (0..127).rev().enumerate() {
let cell = target.get_mut(x, y).unwrap(); let cell = target.get_mut(x, y).unwrap();
if notes_on[note] { if notes_on[note] {
cell.set_fg(Color::Rgb(255, 255, 255)); cell.set_fg(Color::Rgb(255, 255, 255));
cell.set_bg(Color::Rgb(0, 0, 0)); cell.set_bg(Color::Rgb(0, 0, 0));
cell.set_char('▄'); cell.set_char('▄');
cell.set_style(style); cell.set_style(style);
} else {
cell.set_char('x');
} }
} }
for event in phrase.notes[time].iter() { for event in phrase.notes[time].iter() {