fixing transport

This commit is contained in:
🪞👃🪞 2025-01-01 19:42:07 +01:00
parent 863d57447a
commit b2d8d25366

View file

@ -23,11 +23,16 @@ from_jack!(|jack|TransportTui Self {
has_clock!(|self: TransportTui|&self.clock);
audio!(|self: TransportTui, client, scope|ClockAudio(self).process(client, scope));
handle!(<Tui>|self: TransportTui, from|TransportCommand::execute_with_state(self, from));
render!(Tui: (self: TransportTui) => Bsp::s("play", "pause"));//play/pause");//PlayPause(false));
/*Align::x(Fixed::y(3, row!(
Fixed::x(5, Fixed::y(3, PlayPause(false))),
TransportView::new(self, Some(self.color), true),
))));*/
render!(Tui: (self: TransportTui) => Bsp::e(
PlayPause(self.clock.is_rolling()),
TransportView::new(self, Some(self.color), true)
));
pub struct PlayPause(pub bool);
render!(Tui: (self: PlayPause) => Tui::bg(
if self.0{Color::Rgb(0,128,0)}else{Color::Rgb(128,64,0)},
Fixed::x(5, Tui::either(self.0,
Tui::fg(Color::Rgb(0, 255, 0), Bsp::s(" 🭍🭑🬽 ", " 🭞🭜🭘 ",)),
Tui::fg(Color::Rgb(255, 128, 0), Bsp::s(" ▗▄▖ ", " ▝▀▘ ",))))));
impl std::fmt::Debug for TransportTui {
fn fmt (&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
f.debug_struct("TransportTui")
@ -88,21 +93,15 @@ impl TransportView {
}
}
}
pub struct PlayPause(pub bool);
render!(Tui: (self: PlayPause) => Tui::bg(
if self.0{Color::Rgb(0,128,0)}else{Color::Rgb(128,64,0)},
Fixed::x(5, Tui::either(self.0,
Tui::fg(Color::Rgb(0, 255, 0), Bsp::s(" 🭍🭑🬽 ", " 🭞🭜🭘 ",)),
Tui::fg(Color::Rgb(255, 128, 0), Bsp::s(" ▗▄▖ ", " ▝▀▘ ",))))));
render!(Tui: (self: TransportView) => {
let color = self.color;
//let transport_field = move|label, value|row!(
//Tui::fg_bg(color.lightest.rgb, color.base.rgb, Tui::bold(true, label)),
//Tui::fg_bg(color.base.rgb, color.darkest.rgb, "▌"),
//Tui::fg_bg(color.lightest.rgb, color.darkest.rgb, format!("{:>10}", value)),
//Tui::fg_bg(color.darkest.rgb, color.base.rgb, "▌"),
//);
Min::x(35, Fixed::y(3, Tui::bg(color.base.rgb, "kyp")))/*Bsp::e(
let transport_field = move|label, value|row!(
Tui::fg_bg(color.lightest.rgb, color.base.rgb, Tui::bold(true, label)),
Tui::fg_bg(color.base.rgb, color.darkest.rgb, ""),
Tui::fg_bg(color.lightest.rgb, color.darkest.rgb, format!("{:>10}", value)),
Tui::fg_bg(color.darkest.rgb, color.base.rgb, ""),
);
Bsp::e(
Fixed::x(17, col!(
transport_field(" Beat", self.beat.clone()),
transport_field(" Time", format!("{:.1}s", self.current_second)),
@ -113,7 +112,7 @@ render!(Tui: (self: TransportView) => {
transport_field(" Chunk", format!("{}", self.chunk)),
transport_field(" Lag", format!("{:.3}ms", self.latency)),
)),
)))*/
)
});
impl HasFocus for TransportTui {
type Item = TransportFocus;