mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
per-port routing; enter/exit fullscreen editor
This commit is contained in:
parent
f938ade839
commit
3e748fefa7
7 changed files with 79 additions and 58 deletions
|
|
@ -23,9 +23,9 @@
|
||||||
(bsp/e :view-meters-input
|
(bsp/e :view-meters-input
|
||||||
(bsp/n (fixed/y 2 :view-status-h2)
|
(bsp/n (fixed/y 2 :view-status-h2)
|
||||||
(bsp/n (fill/x (align/w :view-tracks-inputs))
|
(bsp/n (fill/x (align/w :view-tracks-inputs))
|
||||||
(bsp/s (fill/x (align/w :view-tracks-names))
|
(bsp/s (fill/x (align/w :view-tracks-devices))
|
||||||
(bsp/s (fill/x (align/w :view-tracks-outputs))
|
(bsp/s (fill/x (align/w :view-tracks-outputs))
|
||||||
(bsp/s (fill/x (align/w :view-tracks-devices))
|
(bsp/s (fill/x (align/w :view-tracks-names))
|
||||||
(either :is-editing
|
(fill/xy (either :is-editing
|
||||||
:view-editor
|
(bsp/e (fixed/x 20 :view-scenes-names) :view-editor)
|
||||||
:view-tracks-scenes))))))))))
|
:view-scenes)))))))))))
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,9 @@
|
||||||
(@q launch)
|
(@q launch)
|
||||||
(@t select :select-track-header)
|
(@t select :select-track-header)
|
||||||
(@s select :select-scene-header)
|
(@s select :select-scene-header)
|
||||||
(@tab edit :clip-selected)
|
(@tab project edit)
|
||||||
(@enter edit :clip-selected)
|
(@enter project edit)
|
||||||
|
(@escape project home)
|
||||||
(@shift-I project input-add)
|
(@shift-I project input-add)
|
||||||
(@shift-O project output-add)
|
(@shift-O project output-add)
|
||||||
(@shift-S project scene-add)
|
(@shift-S project scene-add)
|
||||||
|
|
|
||||||
|
|
@ -18,29 +18,6 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm
|
||||||
}));
|
}));
|
||||||
|
|
||||||
#[tengri_proc::command(App)] impl AppCommand {
|
#[tengri_proc::command(App)] impl AppCommand {
|
||||||
fn edit (app: &mut App) -> Perhaps<Self> {
|
|
||||||
app.project.editor = if app.project.editor.is_some() {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
let selection = app.selection().clone();
|
|
||||||
match selection {
|
|
||||||
Selection::TrackClip { track, scene } => {
|
|
||||||
let clip = &mut app.scenes_mut()[scene].clips[track];
|
|
||||||
if clip.is_none() {
|
|
||||||
//app.clip_auto_create();
|
|
||||||
*clip = Some(Arc::new(RwLock::new(MidiClip::new(
|
|
||||||
"", false, 384, None, Some(ItemTheme::random())
|
|
||||||
))));
|
|
||||||
}
|
|
||||||
clip.as_ref().map(|c|c.into())
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
fn dialog (app: &mut App, dialog: Option<Dialog>) -> Perhaps<Self> {
|
fn dialog (app: &mut App, dialog: Option<Dialog>) -> Perhaps<Self> {
|
||||||
app.toggle_dialog(dialog);
|
app.toggle_dialog(dialog);
|
||||||
Ok(None)
|
Ok(None)
|
||||||
|
|
|
||||||
|
|
@ -113,12 +113,18 @@ impl App {
|
||||||
pub fn view_audio_outs_status (&self) -> impl Content<TuiOut> + use<'_> {
|
pub fn view_audio_outs_status (&self) -> impl Content<TuiOut> + use<'_> {
|
||||||
self.project.view_audio_outs_status(self.color)
|
self.project.view_audio_outs_status(self.color)
|
||||||
}
|
}
|
||||||
pub fn view_tracks_scenes (&self) -> impl Content<TuiOut> + use<'_> {
|
pub fn view_scenes (&self) -> impl Content<TuiOut> + use<'_> {
|
||||||
Bsp::e(
|
Bsp::e(
|
||||||
Fixed::x(20, Align::nw(self.project.view_scenes_names())),
|
Fixed::x(20, Align::nw(self.project.view_scenes_names())),
|
||||||
self.project.view_scenes_clips(),
|
self.project.view_scenes_clips(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
pub fn view_scenes_names (&self) -> impl Content<TuiOut> + use<'_> {
|
||||||
|
self.project.view_scenes_names()
|
||||||
|
}
|
||||||
|
pub fn view_scenes_clips (&self) -> impl Content<TuiOut> + use<'_> {
|
||||||
|
self.project.view_scenes_clips()
|
||||||
|
}
|
||||||
pub fn view_tracks_inputs <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
|
pub fn view_tracks_inputs <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
|
||||||
Fixed::y(2 + self.project.midi_ins.len() as u16, self.project.view_inputs(self.color))
|
Fixed::y(2 + self.project.midi_ins.len() as u16, self.project.view_inputs(self.color))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,33 @@ impl Arrangement {
|
||||||
|
|
||||||
#[tengri_proc::command(Arrangement)]
|
#[tengri_proc::command(Arrangement)]
|
||||||
impl ArrangementCommand {
|
impl ArrangementCommand {
|
||||||
|
fn home (arranger: &mut Arrangement) -> Perhaps<Self> {
|
||||||
|
arranger.editor = None;
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
fn edit (arranger: &mut Arrangement) -> Perhaps<Self> {
|
||||||
|
let selection = arranger.selection().clone();
|
||||||
|
arranger.editor = if arranger.editor.is_some() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
match selection {
|
||||||
|
Selection::TrackClip { track, scene } => {
|
||||||
|
let clip = &mut arranger.scenes_mut()[scene].clips[track];
|
||||||
|
if clip.is_none() {
|
||||||
|
//app.clip_auto_create();
|
||||||
|
*clip = Some(Arc::new(RwLock::new(MidiClip::new(
|
||||||
|
"", false, 384, None, Some(ItemTheme::random())
|
||||||
|
))));
|
||||||
|
}
|
||||||
|
clip.as_ref().map(|c|c.into())
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
/// Set the selection
|
/// Set the selection
|
||||||
fn select (arranger: &mut Arrangement, s: Selection) -> Perhaps<Self> {
|
fn select (arranger: &mut Arrangement, s: Selection) -> Perhaps<Self> {
|
||||||
*arranger.selection_mut() = s;
|
*arranger.selection_mut() = s;
|
||||||
|
|
|
||||||
|
|
@ -20,18 +20,20 @@ impl Arrangement {
|
||||||
Tui::bg(theme.darker.rgb, Align::w(Fill::x(
|
Tui::bg(theme.darker.rgb, Align::w(Fill::x(
|
||||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||||
for (index, track, x1, x2) in self.tracks_with_sizes() {
|
for (index, track, x1, x2) in self.tracks_with_sizes() {
|
||||||
add(&Fixed::xy(self.track_width(index, track), h,
|
add(&Fixed::x(self.track_width(index, track),
|
||||||
Align::nw(Bsp::s(
|
Stack::south(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||||
Tui::bg(track.color.base.rgb,
|
let index = 0;
|
||||||
Fill::x(Align::w(row!(
|
add(&Fixed::y(1, track.sequencer.midi_ins.get(0).map(|port|
|
||||||
|
Tui::fg_bg(Rgb(255, 255, 255), track.color.base.rgb,
|
||||||
|
Fill::x(Align::w(format!("·i{index:02} {}", port.name())))))));
|
||||||
|
for (index, port) in self.midi_ins().iter().enumerate() {
|
||||||
|
add(&Fixed::y(1, Align::w(row!(
|
||||||
Either(track.sequencer.monitoring, Tui::fg(Green, "●mon "), "·mon "),
|
Either(track.sequencer.monitoring, Tui::fg(Green, "●mon "), "·mon "),
|
||||||
Either(track.sequencer.recording, Tui::fg(Red, "●rec "), "·rec "),
|
Either(track.sequencer.recording, Tui::fg(Red, "●rec "), "·rec "),
|
||||||
Either(track.sequencer.overdub, Tui::fg(Yellow, "●dub "), "·dub "),
|
Either(track.sequencer.overdub, Tui::fg(Yellow, "●dub "), "·dub "),
|
||||||
)))),
|
))));
|
||||||
Map::south(1, ||track.sequencer.midi_ins.iter(),
|
}
|
||||||
|port, index|Tui::fg_bg(Rgb(255, 255, 255), track.color.dark.rgb,
|
})))}})))))
|
||||||
Fill::x(Align::w(format!("·i{index:02} {}", port.name())))))))));
|
|
||||||
}})))))
|
|
||||||
}
|
}
|
||||||
pub fn view_outputs <'a> (&'a self, theme: ItemTheme) -> impl Content<TuiOut> + 'a {
|
pub fn view_outputs <'a> (&'a self, theme: ItemTheme) -> impl Content<TuiOut> + 'a {
|
||||||
let mut h = 1u16;
|
let mut h = 1u16;
|
||||||
|
|
@ -53,10 +55,18 @@ impl Arrangement {
|
||||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||||
for (index, track, x1, x2) in self.tracks_with_sizes() {
|
for (index, track, x1, x2) in self.tracks_with_sizes() {
|
||||||
add(&Fixed::x(self.track_width(index, track),
|
add(&Fixed::x(self.track_width(index, track),
|
||||||
Align::nw(Fill::y(Map::south(1, ||track.sequencer.midi_outs.iter(),
|
Stack::south(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||||
|port, index|Tui::fg(Rgb(255, 255, 255),
|
let index = 0;
|
||||||
Fixed::y(1, Tui::bg(track.color.dark.rgb, Fill::x(Align::w(
|
add(&Fixed::y(1, track.sequencer.midi_outs.get(0).map(|port|
|
||||||
format!("·o{index:02} {}", port.name())))))))))));
|
Tui::fg_bg(Rgb(255, 255, 255), track.color.base.rgb,
|
||||||
|
Fill::x(Align::w(format!("·o{index:02} {}", port.name())))))));
|
||||||
|
for (index, port) in self.midi_outs().iter().enumerate() {
|
||||||
|
add(&Fixed::y(1, Align::w(Bsp::e(
|
||||||
|
Either(true, Tui::fg(Green, "●play "), "·play "),
|
||||||
|
Either(false, Tui::fg(Yellow, "●solo "), "·solo "),
|
||||||
|
))));
|
||||||
|
}
|
||||||
|
})));
|
||||||
}
|
}
|
||||||
})))))
|
})))))
|
||||||
}
|
}
|
||||||
|
|
@ -110,7 +120,7 @@ pub trait TracksView:
|
||||||
let active_track = self.selection().track();
|
let active_track = self.selection().track();
|
||||||
let mut x = 0;
|
let mut x = 0;
|
||||||
self.tracks().iter().enumerate().map_while(move |(index, track)|{
|
self.tracks().iter().enumerate().map_while(move |(index, track)|{
|
||||||
let width = active_track.and_then(|_|editor_width).unwrap_or(track.width.max(8));
|
let width = track.width.max(8);
|
||||||
if x + width < self.clips_size().w() {
|
if x + width < self.clips_size().w() {
|
||||||
let data = (index, track, x, x + width);
|
let data = (index, track, x, x + width);
|
||||||
x += width + Self::TRACK_SPACING;
|
x += width + Self::TRACK_SPACING;
|
||||||
|
|
@ -143,7 +153,11 @@ pub trait TracksView:
|
||||||
fn view_track_names (&self, theme: ItemTheme) -> impl Content<TuiOut> {
|
fn view_track_names (&self, theme: ItemTheme) -> impl Content<TuiOut> {
|
||||||
self.view_track_row_section(
|
self.view_track_row_section(
|
||||||
theme,
|
theme,
|
||||||
button_2("t", "rack ", false),
|
button_3("t", "rack ", if let Some(track) = self.selection().track() {
|
||||||
|
format!("{track}/{}", self.tracks().len())
|
||||||
|
} else {
|
||||||
|
format!("{}", self.tracks().len())
|
||||||
|
}, false),
|
||||||
button_2("T", "+", false),
|
button_2("T", "+", false),
|
||||||
Tui::bg(theme.darker.rgb, Fixed::y(2, Fill::x(
|
Tui::bg(theme.darker.rgb, Fixed::y(2, Fill::x(
|
||||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||||
|
|
@ -156,11 +170,7 @@ pub trait TracksView:
|
||||||
}, Bsp::s(Fill::x(Align::nw(Bsp::e(
|
}, Bsp::s(Fill::x(Align::nw(Bsp::e(
|
||||||
format!("·t{index:02} "),
|
format!("·t{index:02} "),
|
||||||
Tui::fg(Rgb(255, 255, 255), Tui::bold(true, &track.name))
|
Tui::fg(Rgb(255, 255, 255), Tui::bold(true, &track.name))
|
||||||
))), Tui::bg(if self.selection().track() == Some(index) {
|
))), ""))) );
|
||||||
track.color.light.rgb
|
|
||||||
} else {
|
|
||||||
track.color.base.rgb
|
|
||||||
}, Fill::x(Align::w(format!("·mute ·solo"))))))));
|
|
||||||
}
|
}
|
||||||
})))))
|
})))))
|
||||||
}
|
}
|
||||||
|
|
@ -179,9 +189,9 @@ pub trait TracksView:
|
||||||
for (index, track, x1, x2) in self.tracks_with_sizes() {
|
for (index, track, x1, x2) in self.tracks_with_sizes() {
|
||||||
add(&Fixed::x(self.track_width(index, track),
|
add(&Fixed::x(self.track_width(index, track),
|
||||||
Align::nw(Fill::y(Map::south(1, ||track.sequencer.midi_outs.iter(),
|
Align::nw(Fill::y(Map::south(1, ||track.sequencer.midi_outs.iter(),
|
||||||
|port, index|Tui::fg(Rgb(255, 255, 255),
|
|port, index|Tui::fg(Rgb(255, 255, 255),
|
||||||
Fixed::y(1, Tui::bg(track.color.dark.rgb, Fill::x(Align::w(
|
Fixed::y(1, Tui::bg(track.color.dark.rgb, Fill::x(Align::w(
|
||||||
format!("·o{index:02} {}", port.name())))))))))));
|
format!("·o{index:02} {}", port.name())))))))))));
|
||||||
}
|
}
|
||||||
})))))
|
})))))
|
||||||
}
|
}
|
||||||
|
|
@ -239,7 +249,7 @@ pub trait ScenesView:
|
||||||
fn scenes_with_sizes (&self) -> impl ScenesSizes<'_> {
|
fn scenes_with_sizes (&self) -> impl ScenesSizes<'_> {
|
||||||
let editing = self.editor().is_some();
|
let editing = self.editor().is_some();
|
||||||
let height = Self::H_SCENE;
|
let height = Self::H_SCENE;
|
||||||
let larger = self.editor().map(|e|e.height()).unwrap_or(Self::H_SCENE);
|
let larger = 8;//FIXME//self.editor().map(|e|e.height()).unwrap_or(Self::H_SCENE);
|
||||||
let selected_track = self.selection().track();
|
let selected_track = self.selection().track();
|
||||||
let selected_scene = self.selection().scene();
|
let selected_scene = self.selection().scene();
|
||||||
let mut y = 0;
|
let mut y = 0;
|
||||||
|
|
|
||||||
2
deps/tengri
vendored
2
deps/tengri
vendored
|
|
@ -1 +1 @@
|
||||||
Subproject commit b1275265702a835d8cf69fbee2ddee1915f6024b
|
Subproject commit 12998a94ea02bc84c1a490783bc76b10789ce37f
|
||||||
Loading…
Add table
Add a link
Reference in a new issue