grid -> arranger

This commit is contained in:
🪞👃🪞 2024-07-08 19:50:18 +03:00
parent d99a08bcf7
commit f1f812d0fb
5 changed files with 131 additions and 191 deletions

View file

@ -18,59 +18,59 @@ use crate::core::*;
#[derive(Default)]
pub struct App {
/// Paths to user directories
pub xdg: Option<Arc<XdgApp>>,
pub xdg: Option<Arc<XdgApp>>,
/// Main JACK client.
pub jack: Option<DynamicAsyncClient>,
pub jack: Option<DynamicAsyncClient>,
/// Main MIDI controller.
pub midi_in: Option<Port<MidiIn>>,
pub midi_in: Option<Port<MidiIn>>,
/// Main audio outputs.
pub audio_outs: Vec<Arc<Port<Unowned>>>,
pub audio_outs: Vec<Arc<Port<Unowned>>>,
/// JACK transport handle.
pub transport: Option<Transport>,
pub transport: Option<Transport>,
/// Current transport state
pub playing: Option<TransportState>,
pub playing: Option<TransportState>,
/// Current position according to transport
pub playhead: usize,
pub playhead: usize,
/// Position of T0 for this playback within global timeline
pub play_started: Option<(usize, usize)>,
pub play_started: Option<(usize, usize)>,
/// Current sample rate and tempo.
pub timebase: Arc<Timebase>,
/// Display mode of grid section
pub grid_mode: bool,
pub timebase: Arc<Timebase>,
/// Display mode of arranger section
pub arranger_mode: bool,
/// Display mode of chain section
pub chain_mode: bool,
pub chain_mode: bool,
/// Display mode of sequencer seciton
pub seq_mode: bool,
pub seq_mode: bool,
/// Optional modal dialog
pub modal: Option<Box<dyn Component>>,
pub modal: Option<Box<dyn Component>>,
/// Currently focused section
pub section: AppSection,
pub section: AppSection,
/// Whether the section is focused
pub entered: bool,
pub entered: bool,
/// Current frame
pub metronome: bool,
pub metronome: bool,
/// Display position of cursor within note range
pub note_cursor: usize,
pub note_cursor: usize,
/// Range of notes to display
pub note_start: usize,
pub note_start: usize,
/// Display position of cursor within time range
pub time_cursor: usize,
pub time_cursor: usize,
/// PPQ per display unit
pub time_zoom: usize,
pub time_zoom: usize,
/// Range of time steps to display
pub time_start: usize,
pub time_start: usize,
/// Focused scene+1, 0 is track list
pub scene_cursor: usize,
pub scene_cursor: usize,
/// Collection of scenes
pub scenes: Vec<Scene>,
pub scenes: Vec<Scene>,
/// Focused track+1, 0 is scene list
pub track_cursor: usize,
pub track_cursor: usize,
/// Collection of tracks
pub tracks: Vec<Track>,
pub chunk_size: usize,
pub quant: usize,
pub tracks: Vec<Track>,
/// Number of frames requested by process callback
pub chunk_size: usize,
/// Quantization factor
pub quant: usize,
}
process!(App |self, _client, scope| {
let (
@ -299,28 +299,28 @@ struct SelectionMut<'a> {
#[derive(PartialEq, Clone, Copy)]
pub enum AppSection {
Grid,
Arranger,
Sequencer,
Chain,
}
impl Default for AppSection {
fn default () -> Self {
Self::Grid
Self::Arranger
}
}
impl AppSection {
pub fn prev (&mut self) {
*self = match self {
Self::Grid => Self::Chain,
Self::Sequencer => Self::Grid,
Self::Arranger => Self::Chain,
Self::Sequencer => Self::Arranger,
Self::Chain => Self::Sequencer,
}
}
pub fn next (&mut self) {
*self = match self {
Self::Grid => Self::Sequencer,
Self::Arranger => Self::Sequencer,
Self::Sequencer => Self::Chain,
Self::Chain => Self::Grid,
Self::Chain => Self::Arranger,
}
}
}