mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
wip: refactor pt.8, 512 errors lol
This commit is contained in:
parent
a1818a8504
commit
a784f7a6f2
19 changed files with 238 additions and 183 deletions
|
|
@ -2,44 +2,40 @@ use crate::*;
|
|||
use std::cmp::PartialEq;
|
||||
|
||||
/// Root level object for standalone `tek_sequencer`
|
||||
pub struct SequencerApp<E: Engine> {
|
||||
/// JACK client handle (needs to not be dropped for standalone mode to work).
|
||||
pub jack: Arc<RwLock<JackClient>>,
|
||||
pub struct SequencerView<E: Engine> {
|
||||
/// Controls the JACK transport.
|
||||
pub transport: Option<Arc<RwLock<TransportToolbar<E>>>>,
|
||||
/// Global timebase
|
||||
pub clock: Arc<TransportTime>,
|
||||
pub transport: TransportView<E>,
|
||||
/// Width of phrase pool
|
||||
pub split: u16,
|
||||
/// Pool of all phrases available to the sequencer
|
||||
pub phrases: Arc<RwLock<PhrasePool<E>>>,
|
||||
pub phrases: PhrasePoolView<E>,
|
||||
/// Phrase editor view
|
||||
pub editor: PhraseEditor<E>,
|
||||
pub editor: PhraseEditor<E>,
|
||||
/// Phrase player
|
||||
pub player: PhrasePlayer,
|
||||
pub player: MIDIPlayer,
|
||||
/// Which view is focused
|
||||
pub focus_cursor: (usize, usize),
|
||||
pub cursor: (usize, usize),
|
||||
/// Whether the currently focused item is entered
|
||||
pub entered: bool,
|
||||
pub entered: bool,
|
||||
}
|
||||
|
||||
impl Content for SequencerApp<Tui> {
|
||||
/// 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.clone()
|
||||
add(&self.phrases
|
||||
.split(Direction::Right, 20, &self.editor as &dyn Widget<Engine = Tui>)
|
||||
.min_y(20))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// JACK process callback for sequencer app
|
||||
impl Audio for SequencerApp {
|
||||
fn process (&mut self, client: &Client, scope: &ProcessScope) -> Control {
|
||||
if let Some(ref transport) = self.transport {
|
||||
transport.write().unwrap().process(client, scope);
|
||||
}
|
||||
self.player.process(client, scope);
|
||||
Control::Continue
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue