refactor: jack proto-lib

This commit is contained in:
🪞👃🪞 2024-07-04 15:32:41 +03:00
parent 4aadc712b8
commit fe6ffea5df
12 changed files with 467 additions and 441 deletions

30
src/jack/process.rs Normal file
View file

@ -0,0 +1,30 @@
use super::*;
/// Trait for things that have a JACK process callback.
pub trait Process {
fn process (&mut self, _: &Client, _: &ProcessScope) -> Control {
Control::Continue
}
}
/// Define the JACK process callback associated with a struct.
#[macro_export] macro_rules! process {
($T:ty) => {
impl Process for $T {}
};
($T:ty |$self:ident, $c:ident, $s:ident|$block:tt) => {
impl Process for $T {
fn process (&mut $self, $c: &Client, $s: &ProcessScope) -> Control {
$block
}
}
};
($T:ty = $process:path) => {
impl Process for $T {
fn process (&mut self, c: &Client, s: &ProcessScope) -> Control {
$process(self, c, s)
}
}
}
}