use PollWatcher (clunky? but finally!)

This commit is contained in:
i do not exist 2026-08-06 08:33:22 +03:00
parent a938b68980
commit 8e97d52a2f
7 changed files with 716 additions and 670 deletions

View file

@ -786,12 +786,10 @@ pub trait TracksView: ScenesView + HasMidiIns + HasMidiOuts + HasTrackScroll {
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
let f = Rgb(255, 255, 255);
let b = track.color.dark.term;
let iter = ||track.sequencer.midi_outs.iter();
let draw = |port: &MidiOutput, _|fg(f, bg(b,
format!("·o{index:02} {}", port.port_name()).full_w().align_w()).exact_h(1));
iter_south(iter, draw).full_h().align_nw()
.exact_w(track_width(index, track))
.draw(to)?;
iter_south(||track.sequencer.midi_outs.iter().map(|port: &MidiOutput|{
fg(f, bg(b, format!("·o{index:02} {}", port.port_name()).full_w().align_w()).exact_h(1))
}))
.full_h().align_nw().exact_w(track_width(index, track)).draw(to)?;
}
Ok(Some(XYWH(0, 0, 0, 0)))
}).align_w()))
@ -812,9 +810,8 @@ pub trait TracksView: ScenesView + HasMidiIns + HasMidiOuts + HasTrackScroll {
either(track.sequencer.recording, fg(Red, "●rec "), "·rec "),
either(track.sequencer.overdub, fg(Yellow, "●dub "), "·dub "),
).align_w().full_w()),
iter_south(||track.sequencer.midi_ins.iter(),
|port, _|fg_bg(Rgb(255, 255, 255), track.color.dark.term,
format!("·i{index:02} {}", port.port_name()).align_w().full_w()))
iter_south(||track.sequencer.midi_ins.iter().map(|port|fg_bg(Rgb(255, 255, 255), track.color.dark.term,
format!("·i{index:02} {}", port.port_name()).align_w().full_w())))
).align_nw().exact_wh(track_width(index, track), height + 1).draw(to)?;
}
Ok(Some(XYWH(0, 0, 0, 0)))
@ -956,13 +953,14 @@ impl Arrangement {
button_2("D", "+", false),
iter_once(self.tracks_with_sizes(), move|(_, track, _x1, _x2), index|bg(
track.color.dark.term,
iter_south(move||0..height,
|_, _index|fg_bg(
ItemTheme::G[32].lightest.term,
ItemTheme::G[32].dark.term,
format!(" · {}", "--").align_nw()
).exact_wh(track.width as u16, 2)
).align_nw()).exact_wh(
iter_south(move||(0..height).map(|_|fg_bg(
ItemTheme::G[32].lightest.term,
ItemTheme::G[32].dark.term,
format!(" · {}", "--").align_nw()
).exact_wh(track.width as u16, 2)))
.align_nw()
)
.exact_wh(
Some(track_width(index, track)),
Some(height + 1),
)))

View file

@ -60,7 +60,7 @@ impl Dialog {
MenuItem("New session".into(), Arc::new(Box::new(|app|Ok({
app.dialog = Dialog::None;
app.mode = app.config.modes.get(":arranger");
app.mode = Some(":arranger".into());
})))),
MenuItem("Load session".into(), Arc::new(Box::new(|_|Ok(())))),

View file

@ -13,11 +13,25 @@
:transport)
(mode :menu (name Menu) (info Mode selector.) (keys :axis/y :confirm)
(view (bg (g 16)
(bsp/s (fill/x (bg (g 32) (max/xy 80 2 :transport)))
(bsp/s (max/y 3 (bg (g 80) :ports/out))
(bsp/n (max/y 3 (bg (g 80) :ports/in))
(bg (g 30) (bsp/s (max/y 6 :logo) :dialog/menu))))))))
(view (bg (g 16) (bsp/n
(bg (g 32) (max/xy 80 2 :transport))
(bsp/s
(max/y 3 (bg (g 80) :ports/out))
(bsp/n
(max/y 3 (bg (g 80) :ports/in))
(bg (g 30) (bsp/s
(max/y 6 :logo)
:dialog/menu))))))))
(view :ports/out
(bsp/s (align/w (text L-AUDIO-OUT))
(bsp/e (text MIDI-OUT)
(align/e (text AUDIO-OUT-R)))))
(view :ports/in
(bsp/s (fill/x (align/w (text L-AUDIO-IN)))
(bsp/e (text MIDI-IN)
(align/e (text AUDIO-IN-R)))))
(mode :sequencer (name Sequencer) (info MIDI sequencer.)
(keys :editor :clock :global)
@ -28,20 +42,12 @@
(bsp/n (fixed/y 1 :status)
(fill (bsp/a (fill/xy (align/e :pool)) :editor)))))
(mode :sampler (name Sampler) (info Sample player.)
(mode :sampler (name Sampler) (info Sample player.)
(keys :sampler/directions :sampler/record :sampler/play)
(bsp/s (fixed/y 1 :transport)
(bsp/n (fixed/y 1 :status)
(fill :samples/grid))))
(view :ports/out
(fill/x (bsp/s (fill/x (align/w (text L-AUDIO-OUT)))
(bsp/e (text MIDI-OUT) (fill/x (align/e (text AUDIO-OUT-R)))))))
(view :ports/in
(fill/x (bsp/s (fill/x (align/w (text L-AUDIO-IN)))
(bsp/e (text MIDI-IN) (fill/x (align/e (text AUDIO-IN-R)))))))
(mode :groovebox (name Groovebox) (info Sequencer with sampler.)
(keys :clock :editor :sampler :global)
(mode browse (keys :browse))
@ -49,11 +55,11 @@
(mode length (keys :pool-length))
(bsp/w :meters/output (bsp/e :meters/input (bsp/w :groove/meta :groove/editor))))
(view :groove/meta (fill/y (align/n (stack/s :midi-ins/status :midi-outs/status :audio-ins/status :audio-outs/status :pool))))
(view :groove/meta (fill/y (align/n (stack/s :midi-ins/status :midi-outs/status :audio-ins/status :audio-outs/status :pool))))
(view :groove/editor (bsp/n :groove/sample :groove/sequence))
(view :groove/editor (bsp/n :groove/sample :groove/sequence))
(view :groove/sample (fixed/y :h-sample-detail (bsp/e (fill/y (fixed/x 20 (align/nw :sample-status))) :sample-viewer)))
(view :groove/sample (fixed/y :h-sample-detail (bsp/e (fill/y (fixed/x 20 (align/nw :sample-status))) :sample-viewer)))
(view :groove/sequence (bsp/e (fill/y (align/n (bsp/s :status/v :editor-status))) (bsp/e :samples/keys :editor)))

1119
src/tek.rs

File diff suppressed because it is too large Load diff