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); has_clock!(|self: TransportTui|&self.clock);
audio!(|self: TransportTui, client, scope|ClockAudio(self).process(client, scope)); audio!(|self: TransportTui, client, scope|ClockAudio(self).process(client, scope));
handle!(<Tui>|self: TransportTui, from|TransportCommand::execute_with_state(self, from)); handle!(<Tui>|self: TransportTui, from|TransportCommand::execute_with_state(self, from));
render!(Tui: (self: TransportTui) => Bsp::s("play", "pause"));//play/pause");//PlayPause(false)); render!(Tui: (self: TransportTui) => Bsp::e(
/*Align::x(Fixed::y(3, row!( PlayPause(self.clock.is_rolling()),
Fixed::x(5, Fixed::y(3, PlayPause(false))), TransportView::new(self, Some(self.color), true)
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 { impl std::fmt::Debug for TransportTui {
fn fmt (&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { fn fmt (&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
f.debug_struct("TransportTui") 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) => { render!(Tui: (self: TransportView) => {
let color = self.color; let color = self.color;
//let transport_field = move|label, value|row!( let transport_field = move|label, value|row!(
//Tui::fg_bg(color.lightest.rgb, color.base.rgb, Tui::bold(true, label)), 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.base.rgb, color.darkest.rgb, ""),
//Tui::fg_bg(color.lightest.rgb, color.darkest.rgb, format!("{:>10}", value)), Tui::fg_bg(color.lightest.rgb, color.darkest.rgb, format!("{:>10}", value)),
//Tui::fg_bg(color.darkest.rgb, color.base.rgb, "▌"), Tui::fg_bg(color.darkest.rgb, color.base.rgb, ""),
//); );
Min::x(35, Fixed::y(3, Tui::bg(color.base.rgb, "kyp")))/*Bsp::e( Bsp::e(
Fixed::x(17, col!( Fixed::x(17, col!(
transport_field(" Beat", self.beat.clone()), transport_field(" Beat", self.beat.clone()),
transport_field(" Time", format!("{:.1}s", self.current_second)), 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(" Chunk", format!("{}", self.chunk)),
transport_field(" Lag", format!("{:.3}ms", self.latency)), transport_field(" Lag", format!("{:.3}ms", self.latency)),
)), )),
)))*/ )
}); });
impl HasFocus for TransportTui { impl HasFocus for TransportTui {
type Item = TransportFocus; type Item = TransportFocus;