transport is rolling

This commit is contained in:
🪞👃🪞 2024-05-31 23:43:12 +03:00
parent 1f928fba9d
commit 4fd208d53f
18 changed files with 540 additions and 498 deletions

View file

@ -1,59 +0,0 @@
mod handle;
mod jack;
mod render;
pub use self::handle::*;
pub use self::jack::*;
pub use self::render::*;
use crate::prelude::*;
pub const ACTIONS: [(&'static str, &'static str);4] = [
("+/-", "Zoom"),
("A/D", "Add/delete note"),
("]/[", "Duration"),
("CapsLock", "Auto advance"),
];
pub struct Sequencer {
exited: bool,
jack: Jack<Notifications>,
cursor: (u16, u16, u16),
sequence: Vec<Vec<Option<Event>>>,
}
#[derive(Clone)]
pub enum Event {
NoteOn(u8, u8),
NoteOff(u8)
}
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 {
exited: false,
cursor: (0, 0, 0),
jack,
sequence: vec![vec![None;64];4],
})
}
}
impl Exitable for Sequencer {
fn exit (&mut self) {
self.exited = true
}
fn exited (&self) -> bool {
self.exited
}
}