use crate::*; impl TryFrom<&Arc>> for SequencerTui { type Error = Box; fn try_from (jack: &Arc>) -> Usually { Ok(Self::new(SequencerTui { phrases: vec![], metronome: false, transport: jack.read().unwrap().transport(), jack: jack.clone(), focused: false, focus: TransportFocus::PlayPause, size: Measure::new(), phrases: vec![], }.into(), None, None)) } } /// Root view for standalone `tek_sequencer`. pub struct SequencerTui { jack: Arc>, playing: RwLock>, started: RwLock>, current: Instant, quant: Quantize, sync: LaunchSync, transport: jack::Transport, metronome: bool, phrases: Vec>>, view_phrase: usize, split: u16, /// Start time and phrase being played play_phrase: Option<(Instant, Option>>)>, /// Start time and next phrase next_phrase: Option<(Instant, Option>>)>, /// 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>, /// Play from current sequence to MIDI ports midi_outputs: Vec>, /// MIDI output buffer midi_note: Vec, /// MIDI output buffer midi_chunk: Vec>>, /// Notes currently held at input notes_in: Arc>, /// Notes currently held at output notes_out: Arc>, } /// Sections in the sequencer app that may be focused #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum SequencerFocus { /// The menu bar is focused Menu, /// The transport (toolbar) is focused Transport, /// The phrase list (pool) is focused PhrasePool, /// The phrase editor (sequencer) is focused PhraseEditor, } impl Audio for SequencerTui { fn process (&mut self, client: &Client, scope: &ProcessScope) -> Control { self.model.process(client, scope) } } impl HasPhrases for SequencerTui { fn phrases (&self) -> &Vec>> { &self.phrases } fn phrases_mut (&mut self) -> &mut Vec>> { &mut self.phrases } } impl HasPhrase for SequencerTui { fn reset (&self) -> bool { self.reset } fn reset_mut (&mut self) -> &mut bool { &mut self.reset } fn phrase (&self) -> &Option<(Instant, Option>>)> { todo!() } fn phrase_mut (&self) -> &mut Option<(Instant, Option>>)> { todo!() } fn next_phrase (&self) -> &Option<(Instant, Option>>)> { todo!() } fn next_phrase_mut (&mut self) -> &mut Option<(Instant, Option>>)> { todo!() } }