mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: reimplement arranger because i'm sick of that shit
This commit is contained in:
parent
182107bfa5
commit
094d5dd451
6 changed files with 120 additions and 12 deletions
|
|
@ -19,7 +19,7 @@ impl App {
|
|||
let cache = self.view_cache.read().unwrap();
|
||||
let theme = self.color;
|
||||
let playing = self.clock().is_rolling();
|
||||
Fixed::xy(20, 6, col!(
|
||||
Tui::bg(theme.darkest.rgb, Fixed::xy(20, 6, col!(
|
||||
Fill::x(Align::w(Bsp::e(
|
||||
Align::w(Tui::bg(if playing { Rgb(0, 128, 0) } else { Rgb(128, 64, 0) },
|
||||
Either::new(false, // TODO
|
||||
|
|
@ -42,7 +42,7 @@ impl App {
|
|||
Fill::x(Align::w(FieldH(theme, "SR ", cache.sr.view.clone()))),
|
||||
Fill::x(Align::w(FieldH(theme, "Buf", cache.buf.view.clone()))),
|
||||
Fill::x(Align::w(FieldH(theme, "Lat", cache.lat.view.clone()))),
|
||||
))
|
||||
)))
|
||||
}
|
||||
pub fn view_status (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
self.update_clock();
|
||||
|
|
@ -92,9 +92,110 @@ impl App {
|
|||
pub fn view_arranger (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
ArrangerView::new(&self.project, self.editor.as_ref())
|
||||
}
|
||||
pub fn view_arranger_track_names (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
let mut max_outputs = 0u16;
|
||||
for track in self.project.tracks.iter() {
|
||||
max_outputs = max_outputs.max(track.sequencer.midi_outs.len() as u16);
|
||||
}
|
||||
Bsp::w(
|
||||
Fixed::x(20, Tui::bg(self.color.darkest.rgb,
|
||||
col!(Tui::bold(true, "[t]rack"), "[T] Add"))),
|
||||
Fixed::y(max_outputs + 1, Tui::bg(self.color.darker.rgb, Align::w(Fill::x(Map::new(
|
||||
||self.project.tracks_with_sizes(&self.project.selection, None)
|
||||
.skip(self.project.track_scroll),
|
||||
move|(index, track, x1, x2): (usize, &Track, usize, usize), _|
|
||||
Push::x(x2 as u16, Fixed::xy(track.width as u16, max_outputs + 1,
|
||||
Tui::bg(track.color.dark.rgb, Align::nw(Bsp::s(
|
||||
Tui::fg(Rgb(255, 255, 255), Tui::bold(true, format!("{}", track.name))),
|
||||
format!("{index} {x1} {x2}"))))))))))))
|
||||
}
|
||||
pub fn view_arranger_track_outputs <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
|
||||
let mut max_outputs = 0u16;
|
||||
for track in self.project.tracks.iter() {
|
||||
max_outputs = max_outputs.max(track.sequencer.midi_outs.len() as u16);
|
||||
}
|
||||
Bsp::w(
|
||||
Fixed::x(20, Tui::bg(self.color.darkest.rgb,
|
||||
col!(Tui::bold(true, "[o]utput"), "[O] Add"))),
|
||||
Fixed::y(max_outputs + 1, Tui::bg(self.color.darker.rgb, Align::w(Fill::x(Map::new(
|
||||
||self.project.tracks_with_sizes(&self.project.selection, None)
|
||||
.skip(self.project.track_scroll),
|
||||
move|(index, track, x1, x2): (usize, &'a Track, usize, usize), _|
|
||||
Push::x(x2 as u16, Tui::bg(track.color.dark.rgb, Fixed::xy(
|
||||
track.width as u16,
|
||||
max_outputs + 1,
|
||||
Align::nw(Bsp::s(
|
||||
format!("[mut] [sol]"),
|
||||
Map::south(1, ||track.sequencer.midi_outs.iter(),
|
||||
|port, index|Tui::fg(Rgb(255, 255, 255),
|
||||
format!("{index}: {}", port.name()))))))))))))))
|
||||
}
|
||||
pub fn view_arranger_track_inputs <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
|
||||
let mut max_inputs = 0u16;
|
||||
for track in self.project.tracks.iter() {
|
||||
max_inputs = max_inputs.max(track.sequencer.midi_ins.len() as u16);
|
||||
}
|
||||
Bsp::w(
|
||||
Fixed::x(20, Tui::bg(self.color.darkest.rgb,
|
||||
col!(Tui::bold(true, "[i]nputs"), "[I] Add"))),
|
||||
Fixed::y(max_inputs + 1, Tui::bg(self.color.darker.rgb, Align::w(Fill::x(Map::new(
|
||||
||self.project.tracks_with_sizes(&self.project.selection, None)
|
||||
.skip(self.project.track_scroll),
|
||||
move|(index, track, x1, x2): (usize, &'a Track, usize, usize), _|
|
||||
Push::x(x2 as u16, Fixed::xy(track.width as u16, max_inputs + 1,
|
||||
Tui::bg(track.color.dark.rgb, Align::nw(Bsp::s(
|
||||
format!("[rec] [mon]"),
|
||||
Map::south(1, ||track.sequencer.midi_ins.iter(),
|
||||
|port, index|Tui::fg(Rgb(255, 255, 255),
|
||||
format!("{index}: {}", port.name()))))))))))))))
|
||||
}
|
||||
pub fn view_arranger_track_devices <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
|
||||
let mut max_devices = 2u16;
|
||||
for track in self.project.tracks.iter() {
|
||||
max_devices = max_devices.max(track.devices.len() as u16);
|
||||
}
|
||||
Bsp::w(
|
||||
Fixed::x(20, Tui::bg(self.color.darkest.rgb,
|
||||
col!(Tui::bold(true, "[d]evice"), "[D] Add"))),
|
||||
Fixed::y(max_devices, Tui::bg(self.color.darker.rgb, Align::w(Fill::x(Map::new(
|
||||
||self.project.tracks_with_sizes(&self.project.selection, None)
|
||||
.skip(self.project.track_scroll),
|
||||
move|(index, track, x1, x2): (usize, &'a Track, usize, usize), _|
|
||||
Push::x(x2 as u16, Fixed::xy(track.width as u16, max_devices + 1,
|
||||
Tui::bg(track.color.dark.rgb, Align::nw(Map::south(1, move||0..max_devices,
|
||||
|_, index|format!("{index}: {}", "--------"))))))))))))
|
||||
}
|
||||
pub fn view_arranger_track_scenes <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
|
||||
let mut max_devices = 0u16;
|
||||
for track in self.project.tracks.iter() {
|
||||
max_devices = max_devices.max(track.devices.len() as u16);
|
||||
}
|
||||
Bsp::w(
|
||||
Fixed::x(20, Tui::bg(self.color.darkest.rgb,
|
||||
col!(Tui::bold(true, "Devices"), "[d] Select", "[D] Add"))),
|
||||
Fixed::y(max_devices + 1, Tui::bg(self.color.darker.rgb, Align::w(Fill::x(Map::new(
|
||||
||self.project.tracks_with_sizes(&self.project.selection, None)
|
||||
.skip(self.project.track_scroll),
|
||||
move|(index, track, x1, x2): (usize, &'a Track, usize, usize), _|
|
||||
Push::x(x2 as u16, Fixed::xy(track.width as u16, max_devices + 1,
|
||||
Align::nw(Map::south(1, ||track.devices.iter(),
|
||||
|device, index|format!("{index}: {}", device.name())))))))))))
|
||||
}
|
||||
pub fn view_arranger_scene_names <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
|
||||
Fixed::y(self.project.scenes.len() as u16 * 2,
|
||||
Tui::bg(self.color.darker.rgb,
|
||||
Align::w(Fill::x(Map::new(
|
||||
||self.project.scenes.iter().skip(self.project.scene_scroll),
|
||||
move|scene: &Scene, index|
|
||||
Push::y(index as u16 * 2u16, Fixed::xy(20, 2,
|
||||
Tui::bg(scene.color.dark.rgb, Align::nw(Bsp::e(
|
||||
format!(" {index:2} "),
|
||||
Tui::fg(Rgb(255, 255, 255),
|
||||
Tui::bold(true, format!("{}", scene.name)))))))))))))
|
||||
}
|
||||
pub fn view_pool (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
Fixed::x(20, Bsp::s(
|
||||
Fill::x(Align::w(FieldH(self.color, "MIDI clip pool:", ""))),
|
||||
Fill::x(Align::w(FieldH(self.color, "Clip pool:", ""))),
|
||||
Fill::y(Align::n(Tui::bg(Rgb(0, 0, 0), PoolView(&self.project.pool)))),
|
||||
))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ pub enum LaunchMode {
|
|||
/// Number of tracks
|
||||
#[arg(short = 'x', long, default_value_t = 4)] tracks: usize,
|
||||
/// Width of tracks
|
||||
#[arg(short = 'w', long, default_value_t = 12)] track_width: usize,
|
||||
#[arg(short = 'w', long, default_value_t = 14)] track_width: usize,
|
||||
},
|
||||
/// TODO: A MIDI-controlled audio mixer
|
||||
Mixer,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use crate::*;
|
|||
/// Define a type alias for iterators of sized items (columns).
|
||||
macro_rules! def_sizes_iter {
|
||||
($Type:ident => $($Item:ty),+) => {
|
||||
pub(crate) trait $Type<'a> =
|
||||
pub trait $Type<'a> =
|
||||
Iterator<Item=(usize, $(&'a $Item,)+ usize, usize)> + Send + Sync + 'a;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ impl<'a> ArrangerView<'a> {
|
|||
) -> Self {
|
||||
let is_editing = editor.is_some();
|
||||
let h_tracks_area = 5;
|
||||
let h_scenes_area = (arrangement.height() as u16).saturating_sub(50);
|
||||
let h_scenes_area = (arrangement.height() as u16).saturating_sub(20);
|
||||
let h_scenes = arrangement.h_scenes(is_editing);
|
||||
Self {
|
||||
arrangement,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue