wip: running interface in separate or combined mode

also disassociating render functions from state structs
This commit is contained in:
🪞👃🪞 2024-05-28 22:13:20 +03:00
parent f9218e887a
commit d6bf840a1f
31 changed files with 905 additions and 532 deletions

39
src/sequencer.rs Normal file
View file

@ -0,0 +1,39 @@
mod handle;
mod render;
mod jack;
pub use self::handle::*;
pub use self::render::*;
pub use self::jack::*;
use crate::prelude::*;
pub struct Sequencer {
jack: Jack<Notifications>,
exit: bool,
stdout: Stdout,
cursor: (u16, u16),
duration: u16,
}
impl Sequencer {
pub fn new () -> Result<Self, Box<dyn Error>> {
let (client, status) = Client::new(
"bloop-sequencer",
ClientOptions::NO_START_SERVER
)?;
let jack = client.activate_async(
Notifications,
ClosureProcessHandler::new(Box::new(
move |_: &Client, _: &ProcessScope| -> Control {
Control::Continue
}) as Box<dyn FnMut(&Client, &ProcessScope)->Control + Send>
)
)?;
Ok(Self {
exit: false,
stdout: std::io::stdout(),
cursor: (0, 0),
duration: 0,
jack,
})
}
}