add --bpm flag

This commit is contained in:
🪞👃🪞 2025-01-02 16:38:04 +01:00
parent 42e2ef2a50
commit 94491a323a
11 changed files with 78 additions and 57 deletions

View file

@ -1,32 +1,5 @@
use crate::*;
pub struct MidiEditStatus<'a>(pub &'a MidiEditor);
render!(Tui: (self:MidiEditStatus<'a>) => {
let (color, name, length, looped) = if let Some(phrase) = self.0.phrase().as_ref().map(|p|p.read().unwrap()) {
(phrase.color, phrase.name.clone(), phrase.length, phrase.looped)
} else {
(ItemPalette::from(TuiTheme::g(64)), String::new(), 0, false)
};
let field = move|x, y|row!(
Tui::fg_bg(color.lighter.rgb, color.darker.rgb, Tui::bold(true, x)),
Tui::fg_bg(color.light.rgb, color.darker.rgb, Tui::bold(true, "")),
Tui::fg_bg(color.lightest.rgb, color.dark.rgb, y),
);
let bg = color.darkest.rgb;
let fg = color.lightest.rgb;
Tui::bg(bg, Fill::x(Tui::fg(fg, row!(
field(" Time", format!("{}/{}-{} ({}*{}) {}",
self.0.time_point(), self.0.time_start().get(), self.0.time_end(),
self.0.time_axis().get(), self.0.time_zoom().get(),
if self.0.time_lock().get() { "[lock]" } else { " " })),
" ",
field(" Note", format!("{} ({}) {} | {}-{} ({})",
self.0.note_point(), Note::pitch_to_name(self.0.note_point()), self.0.note_len(),
Note::pitch_to_name(self.0.note_lo().get()), Note::pitch_to_name(self.0.note_hi()),
self.0.note_axis().get()))
))))
});
/// Status bar for sequencer app
#[derive(Clone)]
pub struct SequencerStatus {