mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
add Arranger model
This commit is contained in:
parent
c85fa3cd06
commit
20e30cb472
14 changed files with 310 additions and 241 deletions
32
src/model.rs
32
src/model.rs
|
|
@ -1,6 +1,6 @@
|
|||
//! Application state.
|
||||
|
||||
submod! { looper mixer phrase plugin sampler scene track transport }
|
||||
submod! { arranger looper mixer phrase plugin sampler scene track transport }
|
||||
|
||||
use crate::{core::*, view::*};
|
||||
|
||||
|
|
@ -13,8 +13,6 @@ pub struct App {
|
|||
pub midi_in: Option<Arc<Port<MidiIn>>>,
|
||||
/// Names of ports to connect to main MIDI IN.
|
||||
pub midi_ins: Vec<String>,
|
||||
/// Display mode of arranger section
|
||||
pub arranger_mode: bool,
|
||||
/// Display mode of chain section
|
||||
pub chain_mode: bool,
|
||||
/// Display mode of sequencer seciton
|
||||
|
|
@ -23,24 +21,12 @@ pub struct App {
|
|||
pub seq_buf: BufferedSequencerView,
|
||||
/// Optional modal dialog
|
||||
pub modal: Option<Box<dyn Exit>>,
|
||||
/// Currently focused section
|
||||
pub section: AppFocus,
|
||||
/// Whether the current focus section has input priority
|
||||
pub entered: bool,
|
||||
/// 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,
|
||||
/// Focused scene+1, 0 is track list
|
||||
pub scene_cursor: usize,
|
||||
/// Collection of scenes
|
||||
pub scenes: Vec<Scene>,
|
||||
/// Focused track+1, 0 is scene list
|
||||
pub track_cursor: usize,
|
||||
/// Collection of tracks
|
||||
pub tracks: Vec<Track>,
|
||||
/// Paths to user directories
|
||||
xdg: Option<Arc<XdgApp>>,
|
||||
/// Main audio outputs.
|
||||
|
|
@ -48,7 +34,13 @@ pub struct App {
|
|||
/// Number of frames requested by process callback
|
||||
chunk_size: usize,
|
||||
/// Transport model and view.
|
||||
pub transport: TransportToolbar,
|
||||
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,
|
||||
}
|
||||
|
||||
impl App {
|
||||
|
|
@ -58,7 +50,7 @@ impl App {
|
|||
let jack = JackClient::Inactive(Client::new("tek", ClientOptions::NO_START_SERVER)?.0);
|
||||
Ok(Self {
|
||||
transport: TransportToolbar::new(Some(jack.transport())),
|
||||
arranger_mode: false,
|
||||
arranger: Arranger::new(),
|
||||
audio_outs: vec![],
|
||||
chain_mode: false,
|
||||
chunk_size: 0,
|
||||
|
|
@ -68,14 +60,10 @@ impl App {
|
|||
midi_ins: vec![],
|
||||
note_cursor: 0,
|
||||
note_start: 2,
|
||||
scene_cursor: 1,
|
||||
scenes: vec![],
|
||||
section: AppFocus::default(),
|
||||
seq_mode: false,
|
||||
seq_buf: BufferedSequencerView::new(96, 16384),
|
||||
time_cursor: 0,
|
||||
track_cursor: 1,
|
||||
tracks: vec![],
|
||||
modal: first_run.then(
|
||||
||Exit::boxed(crate::config::SetupModal(Some(xdg.clone()), false))
|
||||
),
|
||||
|
|
@ -88,7 +76,7 @@ process!(App |self, _client, scope| {
|
|||
reset, current_frames, chunk_size, current_usecs, next_usecs, period_usecs
|
||||
) = self.transport.update(&scope);
|
||||
self.chunk_size = chunk_size;
|
||||
for track in self.tracks.iter_mut() {
|
||||
for track in self.arranger.tracks.iter_mut() {
|
||||
track.process(
|
||||
self.midi_in.as_ref().map(|p|p.iter(&scope)),
|
||||
&self.transport.timebase,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue