mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
implement and bind launch command
This commit is contained in:
parent
6bb73e3896
commit
57b3e48830
4 changed files with 16 additions and 3 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
(@t select :track 0)
|
(@t select :track 0)
|
||||||
(@tab edit :clip)
|
(@tab edit :clip)
|
||||||
(@c color)
|
(@c color)
|
||||||
|
(@q launch)
|
||||||
(@shift-I input add)
|
(@shift-I input add)
|
||||||
(@shift-O output add)
|
(@shift-O output add)
|
||||||
(@shift-S scene add)
|
(@shift-S scene add)
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ handle!(TuiIn: |self: Tek, input|Ok({
|
||||||
Enqueue(Option<Arc<RwLock<MidiClip>>>),
|
Enqueue(Option<Arc<RwLock<MidiClip>>>),
|
||||||
History(isize),
|
History(isize),
|
||||||
Input(InputCommand),
|
Input(InputCommand),
|
||||||
|
Launch,
|
||||||
Output(OutputCommand),
|
Output(OutputCommand),
|
||||||
Pool(PoolCommand),
|
Pool(PoolCommand),
|
||||||
Sampler(SamplerCommand),
|
Sampler(SamplerCommand),
|
||||||
|
|
@ -58,6 +59,7 @@ atom_command!(TekCommand: |app: Tek| {
|
||||||
("color" [c: Color] Some(Self::Color(ItemPalette::random())))
|
("color" [c: Color] Some(Self::Color(ItemPalette::random())))
|
||||||
("color" [c: Color] Some(Self::Color(c.map(ItemPalette::from).expect("no color"))))
|
("color" [c: Color] Some(Self::Color(c.map(ItemPalette::from).expect("no color"))))
|
||||||
("enqueue" [c: Arc<RwLock<MidiClip>>] Some(Self::Enqueue(c)))
|
("enqueue" [c: Arc<RwLock<MidiClip>>] Some(Self::Enqueue(c)))
|
||||||
|
("launch" [] Some(Self::Launch))
|
||||||
("clip" [,..a] ClipCommand::try_from_expr(app, a).map(Self::Clip))
|
("clip" [,..a] ClipCommand::try_from_expr(app, a).map(Self::Clip))
|
||||||
("clock" [,..a] ClockCommand::try_from_expr(app.clock(), a).map(Self::Clock))
|
("clock" [,..a] ClockCommand::try_from_expr(app.clock(), a).map(Self::Clock))
|
||||||
("editor" [,..a] MidiEditCommand::try_from_expr(app.editor.as_ref().expect("no editor"), a).map(Self::Editor))
|
("editor" [,..a] MidiEditCommand::try_from_expr(app.editor.as_ref().expect("no editor"), a).map(Self::Editor))
|
||||||
|
|
@ -138,6 +140,15 @@ command!(|self: TekCommand, app: Tek|match self {
|
||||||
//.map(|sampler|cmd.delegate(sampler, Self::Sampler)).transpose()?.flatten(),
|
//.map(|sampler|cmd.delegate(sampler, Self::Sampler)).transpose()?.flatten(),
|
||||||
//Self::Enqueue(clip) => app.player.as_mut()
|
//Self::Enqueue(clip) => app.player.as_mut()
|
||||||
//.map(|player|{player.enqueue_next(clip.as_ref());None}).flatten(),
|
//.map(|player|{player.enqueue_next(clip.as_ref());None}).flatten(),
|
||||||
|
Self::Launch => {
|
||||||
|
use Selection::*;
|
||||||
|
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()),
|
||||||
|
_ => {}
|
||||||
|
};
|
||||||
|
None
|
||||||
|
},
|
||||||
Self::Color(palette) => {
|
Self::Color(palette) => {
|
||||||
use Selection::*;
|
use Selection::*;
|
||||||
Some(Self::Color(match app.selected {
|
Some(Self::Color(match app.selected {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
(@q clip enqueue :track :scene)
|
|
||||||
(@c clip color :track :scene)
|
|
||||||
(@g clip get)
|
(@g clip get)
|
||||||
(@p clip put)
|
(@p clip put)
|
||||||
(@delete clip del)
|
(@delete clip del)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@ impl Tek {
|
||||||
pub fn view_outputs (&self) -> impl Content<TuiOut> + use<'_> {
|
pub fn view_outputs (&self) -> impl Content<TuiOut> + use<'_> {
|
||||||
let w = self.w_tracks_area();
|
let w = self.w_tracks_area();
|
||||||
let fg = Tui::g(224);
|
let fg = Tui::g(224);
|
||||||
let nexts = self.per_track_top(|_, _|Tui::bg(Reset, " ------ "));
|
let nexts = self.per_track_top(|t, track|Either(
|
||||||
|
track.player.next_clip.is_some(),
|
||||||
|
Thunk::new(||Tui::bg(Reset, " QUEUED ")),
|
||||||
|
Thunk::new(||Tui::bg(Reset, " ------ "))));
|
||||||
let nexts = self.row_top(w, 1, Align::e("Next:"), nexts, ());
|
let nexts = self.row_top(w, 1, Align::e("Next:"), nexts, ());
|
||||||
let froms = self.per_track_top(|_, _|Tui::bg(Reset, Align::c(Bsp::s(" ------ ", OctaveVertical::default(),))));
|
let froms = self.per_track_top(|_, _|Tui::bg(Reset, Align::c(Bsp::s(" ------ ", OctaveVertical::default(),))));
|
||||||
let froms = self.row_top(w, 2, Align::e("From:"), froms, ());
|
let froms = self.row_top(w, 2, Align::e("From:"), froms, ());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue