mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
remove ArrangerMode and Arranger::new
This commit is contained in:
parent
7ddb95d521
commit
2e81549747
4 changed files with 58 additions and 87 deletions
|
|
@ -1,23 +1,21 @@
|
|||
use crate::*;
|
||||
|
||||
mod arranger_command; pub(crate) use self::arranger_command::*;
|
||||
mod arranger_scene; pub(crate) use self::arranger_scene::*;
|
||||
mod arranger_select; pub(crate) use self::arranger_select::*;
|
||||
mod arranger_track; pub(crate) use self::arranger_track::*;
|
||||
mod arranger_tui; pub(crate) use self::arranger_tui::*;
|
||||
mod arranger_mode; pub(crate) use self::arranger_mode::*;
|
||||
mod arranger_command; pub use self::arranger_command::*;
|
||||
mod arranger_scene; pub use self::arranger_scene::*;
|
||||
mod arranger_select; pub use self::arranger_select::*;
|
||||
mod arranger_track; pub use self::arranger_track::*;
|
||||
mod arranger_tui; pub use self::arranger_tui::*;
|
||||
mod arranger_h;
|
||||
|
||||
/// Root view for standalone `tek_arranger`
|
||||
pub struct Arranger {
|
||||
jack: Arc<RwLock<JackConnection>>,
|
||||
pub jack: Arc<RwLock<JackConnection>>,
|
||||
pub clock: Clock,
|
||||
pub pool: PoolModel,
|
||||
pub tracks: Vec<ArrangerTrack>,
|
||||
pub scenes: Vec<ArrangerScene>,
|
||||
pub splits: [u16;2],
|
||||
pub selected: ArrangerSelection,
|
||||
pub mode: ArrangerMode,
|
||||
pub color: ItemPalette,
|
||||
pub size: Measure<TuiOut>,
|
||||
pub note_buf: Vec<u8>,
|
||||
|
|
@ -67,30 +65,6 @@ has_phrases!(|self: Arranger|self.pool.phrases);
|
|||
has_editor!(|self: Arranger|self.editor);
|
||||
handle!(TuiIn: |self: Arranger, input|ArrangerCommand::execute_with_state(self, input.event()));
|
||||
impl Arranger {
|
||||
pub fn new (jack: &Arc<RwLock<JackConnection>>) -> Self {
|
||||
let clock = Clock::from(jack);
|
||||
let phrase = Arc::new(RwLock::new(MidiClip::new(
|
||||
"Clip", true, 4 * clock.timebase.ppq.get() as usize,
|
||||
None, Some(ItemColor::random().into())
|
||||
)));
|
||||
Self {
|
||||
clock,
|
||||
pool: (&phrase).into(),
|
||||
editor: (&phrase).into(),
|
||||
selected: ArrangerSelection::Clip(0, 0),
|
||||
scenes: vec![],
|
||||
tracks: vec![],
|
||||
color: ItemPalette::random(),
|
||||
mode: ArrangerMode::V(1),
|
||||
size: Measure::new(),
|
||||
splits: [12, 20],
|
||||
midi_buf: vec![vec![];65536],
|
||||
note_buf: vec![],
|
||||
perf: PerfModel::default(),
|
||||
jack: jack.clone(),
|
||||
compact: true,
|
||||
}
|
||||
}
|
||||
pub fn selected (&self) -> ArrangerSelection {
|
||||
self.selected
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
use crate::*;
|
||||
/// Display mode of arranger
|
||||
#[derive(Clone, PartialEq)]
|
||||
pub enum ArrangerMode {
|
||||
/// Tracks are columns
|
||||
V(usize),
|
||||
/// Tracks are rows
|
||||
H,
|
||||
}
|
||||
impl<E: Output> Content<E> for ArrangerMode {}
|
||||
/// Arranger display mode can be cycled
|
||||
impl ArrangerMode {
|
||||
/// Cycle arranger display mode
|
||||
pub fn next (&mut self) {
|
||||
*self = match self {
|
||||
Self::H => Self::V(1),
|
||||
Self::V(1) => Self::V(2),
|
||||
Self::V(2) => Self::V(2),
|
||||
Self::V(0) => Self::H,
|
||||
Self::V(_) => Self::V(0),
|
||||
}
|
||||
}
|
||||
}
|
||||
fn any_size <E: Output> (_: E::Size) -> Perhaps<E::Size>{
|
||||
Ok(Some([0.into(),0.into()].into()))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue