wip: refactor pt.36 (10e) fewer structs, more field duplication

This commit is contained in:
🪞👃🪞 2024-11-15 02:21:30 +01:00
parent 7af5bbd02b
commit 92bcd19925
11 changed files with 136 additions and 65 deletions

View file

@ -244,11 +244,15 @@ impl Command<ArrangerApp<Tui>> for ArrangerViewCommand {
/// Root view for standalone `tek_arranger`
pub struct ArrangerView<E: Engine> {
jack: Arc<RwLock<JackClient>>,
clock: Arc<Clock>,
playing: RwLock<Option<TransportState>>,
started: RwLock<Option<(usize, usize)>>,
current: Instant,
quant: Quantize,
sync: LaunchSync,
transport: jack::Transport,
metronome: bool,
transport: TransportModel,
phrases: Vec<Arc<RwLock<Phrase>>>,
phrase: usize,
tracks: Vec<ArrangerTrack>,
scenes: Vec<ArrangerScene>,
name: Arc<RwLock<String>>,
@ -257,6 +261,7 @@ pub struct ArrangerView<E: Engine> {
selected: ArrangerSelection,
mode: ArrangerMode,
color: ItemColor,
editor: PhraseEditor<E>,
focused: bool,
entered: bool,
size: Measure<E>,
@ -833,14 +838,14 @@ impl Content for ArrangerStatusBar {
type Engine = Tui;
fn content (&self) -> impl Widget<Engine = Tui> {
let label = match self {
Self::Transport => "TRANSPORT",
Self::Transport => "TRANSPORT",
Self::ArrangerMix => "PROJECT",
Self::ArrangerTrack => "TRACK",
Self::ArrangerScene => "SCENE",
Self::ArrangerClip => "CLIP",
Self::PhrasePool => "SEQ LIST",
Self::PhraseView => "VIEW SEQ",
Self::PhraseEdit => "EDIT SEQ",
Self::PhrasePool => "SEQ LIST",
Self::PhraseView => "VIEW SEQ",
Self::PhraseEdit => "EDIT SEQ",
};
let status_bar_bg = TuiTheme::status_bar_bg();
let mode_bg = TuiTheme::mode_bg();
@ -1362,3 +1367,49 @@ pub fn arranger_content_horizontal (
)
)
}
#[derive(Default, Debug, Clone)]
pub struct ArrangerScene {
/// Name of scene
pub name: Arc<RwLock<String>>,
/// Clips in scene, one per track
pub clips: Vec<Option<Arc<RwLock<Phrase>>>>,
/// Identifying color of scene
pub color: ItemColor,
}
#[derive(Debug)]
pub struct ArrangerTrack {
/// Name of track
pub name: Arc<RwLock<String>>,
/// Preferred width of track column
pub width: usize,
/// Identifying color of track
pub color: ItemColor,
/// The MIDI player for the track
pub player: MIDIPlayer
/// Start time and phrase being played
play_phrase: Option<(Instant, Option<Arc<RwLock<Phrase>>>)>,
/// Start time and next phrase
next_phrase: Option<(Instant, Option<Arc<RwLock<Phrase>>>)>,
/// Play input through output.
monitoring: bool,
/// Write input to sequence.
recording: bool,
/// Overdub input to sequence.
overdub: bool,
/// Send all notes off
reset: bool, // TODO?: after Some(nframes)
/// Record from MIDI ports to current sequence.
midi_inputs: Vec<Port<MidiIn>>,
/// Play from current sequence to MIDI ports
midi_outputs: Vec<Port<MidiOut>>,
/// MIDI output buffer
midi_note: Vec<u8>,
/// MIDI output buffer
midi_chunk: Vec<Vec<Vec<u8>>>,
/// Notes currently held at input
notes_in: Arc<RwLock<[bool; 128]>>,
/// Notes currently held at output
notes_out: Arc<RwLock<[bool; 128]>>,
}