east and south looparound for arranger

This commit is contained in:
🪞👃🪞 2025-01-28 13:07:58 +01:00
parent 10f8fcc84b
commit 0243e24614
7 changed files with 63 additions and 41 deletions

View file

@ -77,7 +77,7 @@ audio!(
PortRegistration(id, true) => {
//let port = self.jack().port_by_id(id);
//println!("\rport add: {id} {port:?}");
println!("\rport add: {id}");
//println!("\rport add: {id}");
},
PortRegistration(id, false) => {
/*println!("\rport del: {id}")*/

View file

@ -145,6 +145,11 @@ command!(|self: TekCommand, app: Tek|match self {
match app.selected {
Track(t) => app.tracks[t].player.enqueue_next(None),
Clip(t, s) => app.tracks[t].player.enqueue_next(app.scenes[s].clips[t].as_ref()),
Scene(s) => {
for t in 0..app.tracks.len() {
app.tracks[t].player.enqueue_next(app.scenes[s].clips[t].as_ref())
}
},
_ => {}
};
None

View file

@ -1,28 +1,29 @@
use crate::*;
#[derive(Default, Debug)] pub struct Tek {
/// Must not be dropped for the duration of the process
pub jack: Jack,
pub jack: Jack,
/// Source of time
pub clock: Clock,
pub clock: Clock,
/// Theme
pub color: ItemPalette,
pub pool: Option<MidiPool>,
pub editor: Option<MidiEditor>,
pub midi_buf: Vec<Vec<Vec<u8>>>,
pub midi_ins: Vec<JackMidiIn>,
pub midi_outs: Vec<JackMidiOut>,
pub audio_ins: Vec<JackAudioIn>,
pub color: ItemPalette,
pub pool: Option<MidiPool>,
pub editor: Option<MidiEditor>,
pub midi_buf: Vec<Vec<Vec<u8>>>,
pub midi_ins: Vec<JackMidiIn>,
pub midi_outs: Vec<JackMidiOut>,
pub audio_ins: Vec<JackAudioIn>,
pub audio_outs: Vec<JackAudioOut>,
pub note_buf: Vec<u8>,
pub tracks: Vec<Track>,
pub scenes: Vec<Scene>,
pub selected: Selection,
pub splits: Vec<u16>,
pub size: Measure<TuiOut>,
pub perf: PerfModel,
pub editing: AtomicBool,
pub history: Vec<TekCommand>,
pub ports: std::collections::BTreeMap<u32, Port<Unowned>>,
pub note_buf: Vec<u8>,
pub tracks: Vec<Track>,
pub track_scroll: usize,
pub scenes: Vec<Scene>,
pub scene_scroll: usize,
pub selected: Selection,
pub size: Measure<TuiOut>,
pub perf: PerfModel,
pub editing: AtomicBool,
pub history: Vec<TekCommand>,
pub ports: std::collections::BTreeMap<u32, Port<Unowned>>,
/// View definition
pub view: SourceIter<'static>,
@ -72,8 +73,10 @@ provide!(Selection: |self: Tek| {
":scene-next" => match self.selected {
Selection::Mix => Selection::Scene(0),
Selection::Track(t) => Selection::Clip(t, 0),
Selection::Scene(s) => Selection::Scene(s + 1),
Selection::Clip(t, s) => Selection::Clip(t, s + 1),
Selection::Scene(s) if s + 1 < self.scenes.len() => Selection::Scene(s + 1),
Selection::Scene(s) => Selection::Mix,
Selection::Clip(t, s) if s + 1 < self.scenes.len() => Selection::Clip(t, s + 1),
Selection::Clip(t, s) => Selection::Track(t),
},
":scene-prev" => match self.selected {
Selection::Mix => Selection::Mix,
@ -85,9 +88,11 @@ provide!(Selection: |self: Tek| {
},
":track-next" => match self.selected {
Selection::Mix => Selection::Track(0),
Selection::Track(t) => Selection::Track(t + 1),
Selection::Track(t) if t + 1 < self.tracks.len() => Selection::Track(t + 1),
Selection::Track(t) => Selection::Mix,
Selection::Scene(s) => Selection::Clip(0, s),
Selection::Clip(t, s) => Selection::Clip(t + 1, s),
Selection::Clip(t, s) if t + 1 < self.tracks.len() => Selection::Clip(t + 1, s),
Selection::Clip(t, s) => Selection::Scene(s),
},
":track-prev" => match self.selected {
Selection::Mix => Selection::Mix,

View file

@ -17,7 +17,7 @@ impl Tek {
let mon = track.player.monitoring;
let rec = if rec { White } else { track.color.darkest.rgb };
let mon = if mon { White } else { track.color.darkest.rgb };
let bg = if self.selected().track() == Some(t+1) {
let bg = if self.selected().track() == Some(t) {
track.color.light.rgb
} else {
track.color.base.rgb

View file

@ -21,8 +21,8 @@ impl Tek {
let solo = false;
let mute = if mute { White } else { track.color.darkest.rgb };
let solo = if solo { White } else { track.color.darkest.rgb };
let bg = if self.selected().track() == Some(t+1) { track.color.light.rgb } else { track.color.base.rgb };
let bg2 = if t > 0 { self.tracks()[t - 1].color.base.rgb } else { Reset };
let bg = if self.selected().track() == Some(t) { track.color.light.rgb } else { track.color.base.rgb };
let bg2 = if t > 0 { self.tracks()[t].color.base.rgb } else { Reset };
Self::wrap(bg, fg, Tui::bold(true, Fill::x(Bsp::e(
Tui::fg_bg(mute, bg, "Play "),
Tui::fg_bg(solo, bg, "Solo ")))))}),

View file

@ -18,6 +18,19 @@ impl Tek {
let data = (s, scene, y, y + height);
y += height;
data})}
fn scene_scrollbar (&self) -> impl Content<TuiOut> + use<'_> {
Bsp::s(Tui::fg_bg(Rgb(255,255,255), Rgb(0,0,0),""),
Bsp::n(Tui::fg_bg(Rgb(255,255,255), Rgb(0,0,0),""), Bsp::a(
Fill::y(Align::nw(Fixed::xy(1, 1, Tui::fg(Rgb(255,255,255), "")))),
Fill::y(Fixed::x(1, Tui::fg(Rgb(0,0,0), RepeatV("")))),
)))
}
fn track_scrollbar (&self) -> impl Content<TuiOut> + use<'_> {
Bsp::e("", Bsp::w("", Bsp::a(
Fill::x(Align::nw(Fixed::xy(1, 1, Tui::fg(Rgb(255,255,255), "")))),
Fill::x(Fixed::y(1, Tui::fg(Rgb(0,0,0), RepeatH("")))),
)))
}
pub fn view_scenes (&self) -> impl Content<TuiOut> + use<'_> {
let w_full = self.w();
let w = self.w_tracks_area();
@ -26,19 +39,18 @@ impl Tek {
let selected_track = self.selected().track();
let selected_scene = self.selected().scene();
let h = self.h_scenes(editing, Self::H_SCENE, Self::H_EDITOR);
let scrollbar = Fill::y(Fixed::x(1, RepeatV(" ")));
Tui::bg(Reset, Fixed::y(self.h_tracks_area(), self.row(self.w_tracks_area(), h,
Bsp::e(scrollbar, Map::new(
move||self.scenes_with_colors(editing, h_area),
move|(s, scene, y1, y2, prev): SceneColor, _|self.view_scene_name(
w_full, (1 + y2 - y1) as u16, y1 as u16, s, scene, prev))),
self.per_track(move|t, track|Map::new(
move||self.scenes_with_track_colors(editing, h_area, t),
move|(s, scene, y1, y2, prev): SceneColor, _|self.view_scene_clip(
w, (1 + y2 - y1) as u16, y1 as u16,
scene, prev, s, t, editing, selected_track == Some(t), selected_scene))),
(),
))) }
Tui::bg(Reset, Bsp::s(self.track_scrollbar(), Bsp::e(self.scene_scrollbar(),
Fixed::y(self.h_tracks_area(), self.row(self.w_tracks_area(), h,
Map::new(
move||self.scenes_with_colors(editing, h_area),
move|(s, scene, y1, y2, prev): SceneColor, _|self.view_scene_name(
w_full, (1 + y2 - y1) as u16, y1 as u16, s, scene, prev)),
self.per_track(move|t, track|Map::new(
move||self.scenes_with_track_colors(editing, h_area, t),
move|(s, scene, y1, y2, prev): SceneColor, _|self.view_scene_clip(
w, (1 + y2 - y1) as u16, y1 as u16,
scene, prev, s, t, editing, selected_track == Some(t), selected_scene))),
() ))))) }
fn scenes_with_colors (&self, editing: bool, h: u16) -> impl ScenesColors<'_> {
self.scenes_sizes(editing, Self::H_SCENE, Self::H_EDITOR).map_while(
move|(s, scene, y1, y2)|if y2 as u16 > h {

View file

@ -18,7 +18,7 @@ impl Tek {
self.per_track(|t, track|self.view_track_header(t, track)),
self.button2("T", "add track")) }
fn view_track_header <'a> (&self, t: usize, track: &'a Track) -> impl Content<TuiOut> + use<'a> {
let active = self.selected().track() == Some(t+1);
let active = self.selected().track() == Some(t);
let name = &track.name;
let fg = track.color.lightest.rgb;
let bg = if active { track.color.light.rgb } else { track.color.base.rgb };