relayer arranger view and extract button_2 and button_3 to top level

This commit is contained in:
🪞👃🪞 2025-02-09 13:59:51 +01:00
parent d1bb33dc41
commit fe9d5a309e
43 changed files with 7158 additions and 276 deletions

View file

@ -53,7 +53,9 @@ content!(TuiOut:|self: PianoHorizontal| Tui::bg(Tui::g(40), Bsp::s(
)));
impl PianoHorizontal {
/// Draw the piano roll foreground using full blocks on note on and half blocks on legato: █▄ █▄ █▄
/// Draw the piano roll background.
///
/// This mode uses full blocks on note on and half blocks on legato: █▄ █▄ █▄
fn draw_bg (buf: &mut BigBuffer, clip: &MidiClip, zoom: usize, note_len: usize) {
for (y, note) in (0..=127).rev().enumerate() {
for (x, time) in (0..buf.width).map(|x|(x, x*zoom)) {
@ -81,7 +83,9 @@ impl PianoHorizontal {
}
}
}
/// Draw the piano roll background using full blocks on note on and half blocks on legato: █▄ █▄ █▄
/// Draw the piano roll foreground.
///
/// This mode uses full blocks on note on and half blocks on legato: █▄ █▄ █▄
fn draw_fg (buf: &mut BigBuffer, clip: &MidiClip, zoom: usize) {
let style = Style::default().fg(clip.color.base.rgb);//.bg(Rgb(0, 0, 0));
let mut notes_on = [false;128];
@ -251,8 +255,8 @@ impl MidiViewer for PianoHorizontal {
(clip.length / self.range.time_zoom().get(), 128)
}
fn redraw (&self) {
let buffer = if let Some(clip) = self.clip.as_ref() {
let clip = clip.read().unwrap();
*self.buffer.write().unwrap() = if let Some(clip) = self.clip.as_ref() {
let clip = clip.read().unwrap();
let buf_size = self.buffer_size(&clip);
let mut buffer = BigBuffer::from(buf_size);
let note_len = self.note_len();
@ -263,8 +267,7 @@ impl MidiViewer for PianoHorizontal {
buffer
} else {
Default::default()
};
*self.buffer.write().unwrap() = buffer
}
}
fn set_clip (&mut self, clip: Option<&Arc<RwLock<MidiClip>>>) {
*self.clip_mut() = clip.cloned();