mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-10 21:56:42 +01:00
wip: running interface in separate or combined mode
also disassociating render functions from state structs
This commit is contained in:
parent
f9218e887a
commit
d6bf840a1f
31 changed files with 905 additions and 532 deletions
1
src/transport/handle.rs
Normal file
1
src/transport/handle.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
use crate::prelude::*;
|
||||
40
src/transport/jack.rs
Normal file
40
src/transport/jack.rs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
struct Notifications;
|
||||
|
||||
impl NotificationHandler for Notifications {
|
||||
fn thread_init (&self, _: &Client) {
|
||||
}
|
||||
|
||||
fn shutdown (&mut self, status: ClientStatus, reason: &str) {
|
||||
}
|
||||
|
||||
fn freewheel (&mut self, _: &Client, is_enabled: bool) {
|
||||
}
|
||||
|
||||
fn sample_rate (&mut self, _: &Client, _: Frames) -> Control {
|
||||
Control::Quit
|
||||
}
|
||||
|
||||
fn client_registration (&mut self, _: &Client, name: &str, is_reg: bool) {
|
||||
}
|
||||
|
||||
fn port_registration (&mut self, _: &Client, port_id: PortId, is_reg: bool) {
|
||||
}
|
||||
|
||||
fn port_rename (&mut self, _: &Client, id: PortId, old: &str, new: &str) -> Control {
|
||||
Control::Continue
|
||||
}
|
||||
|
||||
fn ports_connected (&mut self, _: &Client, id_a: PortId, id_b: PortId, are: bool) {
|
||||
}
|
||||
|
||||
fn graph_reorder (&mut self, _: &Client) -> Control {
|
||||
Control::Continue
|
||||
}
|
||||
|
||||
fn xrun (&mut self, _: &Client) -> Control {
|
||||
Control::Continue
|
||||
}
|
||||
}
|
||||
|
||||
40
src/transport/render.rs
Normal file
40
src/transport/render.rs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
use crate::prelude::*;
|
||||
use super::{Transport, ACTIONS};
|
||||
|
||||
pub fn render (
|
||||
state: &mut Transport,
|
||||
stdout: &mut Stdout,
|
||||
mut offset: (u16, u16)
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
use crossterm::{*, cursor::{Hide, MoveTo}, style::{*, Stylize}};
|
||||
let (w, h) = crate::render::render_toolbar_vertical(stdout, offset, &ACTIONS)?;
|
||||
offset.0 = offset.0 + w + 2;
|
||||
let move_to = |col, row| MoveTo(offset.0 + col, offset.1 + row);
|
||||
stdout.queue(move_to( 1, 0))?.queue(
|
||||
Print("Project: ")
|
||||
)?.queue(move_to(10, 0))?.queue(
|
||||
PrintStyledContent("The Quick Brown Fox - Jumping Over Lazy Dogs".white().bold())
|
||||
)?.queue(move_to( 1, 2))?.queue(
|
||||
Print("Rate: ")
|
||||
)?.queue(move_to( 7, 2))?.queue(
|
||||
PrintStyledContent("48000Hz".white().bold())
|
||||
)?.queue(move_to(20, 2))?.queue(
|
||||
Print("BPM: ")
|
||||
)?.queue(move_to(25, 2))?.queue(
|
||||
PrintStyledContent("120.34".white().bold())
|
||||
)?.queue(move_to(35, 2))?.queue(
|
||||
Print("Signature: ")
|
||||
)?.queue(move_to(46, 2))?.queue(
|
||||
PrintStyledContent("4 / 4".white().bold())
|
||||
)?.queue(move_to( 1, 4))?.queue(
|
||||
Print("Time: ")
|
||||
)?.queue(move_to( 7, 4))?.queue(
|
||||
PrintStyledContent("1m 23.456s".white().bold())
|
||||
)?.queue(move_to(20, 4))?.queue(
|
||||
Print("Beat: ")
|
||||
)?.queue(move_to(26, 4))?.queue(
|
||||
PrintStyledContent("30x 3/4".white().bold())
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue