wip: refresh mixer components

This commit is contained in:
🪞👃🪞 2024-11-04 21:01:16 +02:00
parent 1dbc5d1bb7
commit bc679ef8bd
16 changed files with 296 additions and 287 deletions

View file

@ -2,20 +2,38 @@ use crate::*;
use jack::*;
/// Trait for things that wrap a JACK client.
pub trait AudioEngine {
fn activate(
fn activate (
self,
process: impl FnMut(&Arc<RwLock<Self>>, &Client, &ProcessScope) -> Control + Send + 'static
) -> Usually<Arc<RwLock<Self>>> where Self: Send + Sync + 'static;
fn client(&self) -> &Client;
fn transport(&self) -> Transport {
fn client (&self) -> &Client;
fn transport (&self) -> Transport {
self.client().transport()
}
fn port_by_name(&self, name: &str) -> Option<Port<Unowned>> {
fn port_by_name (&self, name: &str) -> Option<Port<Unowned>> {
self.client().port_by_name(name)
}
fn register_port<PS: PortSpec>(&self, name: &str, spec: PS) -> Usually<Port<PS>> {
fn register_port <PS: PortSpec> (&self, name: &str, spec: PS) -> Usually<Port<PS>> {
Ok(self.client().register_port(name, spec)?)
}
fn thread_init (&self, _: &Client) {}
unsafe fn shutdown (&mut self, status: ClientStatus, reason: &str) {}
fn freewheel (&mut self, _: &Client, enabled: bool) {}
fn client_registration (&mut self, _: &Client, name: &str, reg: bool) {}
fn port_registration (&mut self, _: &Client, id: PortId, reg: bool) {}
fn ports_connected (&mut self, _: &Client, a: PortId, b: PortId, are: bool) {}
fn sample_rate (&mut self, _: &Client, frames: Frames) -> Control {
Control::Continue
}
fn port_rename (&mut self, _: &Client, id: PortId, old: &str, new: &str) -> Control {
Control::Continue
}
fn graph_reorder (&mut self, _: &Client) -> Control {
Control::Continue
}
fn xrun (&mut self, _: &Client) -> Control {
Control::Continue
}
}
/// Wraps [Client] or [DynamicAsyncClient] in place.
pub enum JackClient {