tek/crates/tek_tui/src/tui_sequencer.rs

37 lines
1.1 KiB
Rust

use crate::*;
use std::cmp::PartialEq;
/// Root level object for standalone `tek_sequencer`
pub struct SequencerView<E: Engine> {
/// Controls the JACK transport.
pub transport: TransportView<E>,
/// Width of phrase pool
pub split: u16,
/// Pool of all phrases available to the sequencer
pub phrases: PhrasePoolView<E>,
/// Phrase editor view
pub editor: PhraseEditor<E>,
/// Phrase player
pub player: MIDIPlayer,
}
/// JACK process callback for sequencer app
impl<E: Engine> Audio for SequencerView<E> {
fn process (&mut self, client: &Client, scope: &ProcessScope) -> Control {
self.transport.process(client, scope);
self.player.process(client, scope);
Control::Continue
}
}
impl Content for SequencerView<Tui> {
type Engine = Tui;
fn content (&self) -> impl Widget<Engine = Tui> {
Stack::down(move|add|{
add(&self.transport)?;
add(&self.phrases
.split(Direction::Right, 20, &self.editor as &dyn Widget<Engine = Tui>)
.min_y(20))
})
}
}