add Justfile and tweak things

This commit is contained in:
🪞👃🪞 2024-07-13 16:26:27 +03:00
parent a017d2ca51
commit f347ca838b
5 changed files with 95 additions and 86 deletions

View file

@ -6,41 +6,42 @@ use crate::{core::*, view::*};
/// Root of application state.
pub struct App {
/// Optional modal dialog
pub modal: Option<Box<dyn Exit>>,
/// Whether the currently focused section has input priority
pub entered: bool,
/// Currently focused section
pub section: AppFocus,
/// Transport model and view.
pub transport: TransportToolbar,
/// Arraneger model and view.
pub arranger: Arranger,
/// Main JACK client.
pub jack: Option<JackClient>,
pub jack: Option<JackClient>,
/// Map of external MIDI outs in the jack graph
/// to internal MIDI ins of this app.
pub midi_in: Option<Arc<Port<MidiIn>>>,
pub midi_in: Option<Arc<Port<MidiIn>>>,
/// Names of ports to connect to main MIDI IN.
pub midi_ins: Vec<String>,
pub midi_ins: Vec<String>,
/// Display mode of chain section
pub chain_mode: bool,
/// Display mode of sequencer seciton
pub seq_mode: bool,
/// Display buffer for sequencer
pub seq_buf: BufferedSequencerView,
/// Optional modal dialog
pub modal: Option<Box<dyn Exit>>,
/// Display position of cursor within note range
pub note_cursor: usize,
/// Range of notes to display
pub note_start: usize,
/// Display position of cursor within time range
pub time_cursor: usize,
pub chain_mode: bool,
/// Paths to user directories
xdg: Option<Arc<XdgApp>>,
xdg: Option<Arc<XdgApp>>,
/// Main audio outputs.
pub audio_outs: Vec<Arc<Port<Unowned>>>,
pub audio_outs: Vec<Arc<Port<Unowned>>>,
/// Number of frames requested by process callback
chunk_size: usize,
/// Transport model and view.
pub transport: TransportToolbar,
/// Arraneger model and view.
pub arranger: Arranger,
/// Currently focused section
pub section: AppFocus,
/// Whether the current focus section has input priority
pub entered: bool,
chunk_size: usize,
/// Display mode of sequencer seciton
pub seq_mode: bool,
/// Display buffer for sequencer
pub seq_buf: BufferedSequencerView,
/// Display position of cursor within note range
pub note_cursor: usize,
/// Range of notes to display
pub note_start: usize,
/// Display position of cursor within time range
pub time_cursor: usize,
}
impl App {
@ -49,25 +50,27 @@ impl App {
let first_run = crate::config::AppPaths::new(&xdg)?.should_create();
let jack = JackClient::Inactive(Client::new("tek", ClientOptions::NO_START_SERVER)?.0);
Ok(Self {
transport: TransportToolbar::new(Some(jack.transport())),
arranger: Arranger::new(),
modal: first_run.then(||{
Exit::boxed(crate::config::SetupModal(Some(xdg.clone()), false))
}),
entered: true,
section: AppFocus::default(),
transport: TransportToolbar::new(Some(jack.transport())),
arranger: Arranger::new(),
jack: Some(jack),
audio_outs: vec![],
chain_mode: false,
chunk_size: 0,
entered: true,
jack: Some(jack),
midi_in: None,
midi_ins: vec![],
midi_in: None,
midi_ins: vec![],
xdg: Some(xdg),
seq_mode: false,
seq_buf: BufferedSequencerView::new(96, 16384),
note_cursor: 0,
note_start: 2,
section: AppFocus::default(),
seq_mode: false,
seq_buf: BufferedSequencerView::new(96, 16384),
note_start: 2,
time_cursor: 0,
modal: first_run.then(
||Exit::boxed(crate::config::SetupModal(Some(xdg.clone()), false))
),
xdg: Some(xdg),
})
}
}
@ -133,9 +136,13 @@ impl App {
/// Different sections of the UI that may be focused.
#[derive(PartialEq, Clone, Copy)]
pub enum AppFocus {
/// The transport is selected.
Transport,
/// The arranger is selected.
Arranger,
/// The sequencer is selected.
Sequencer,
/// The device chain is selected.
Chain,
}