pub trait IoDriver: Send + Sync {
// Required methods
fn set_process_callback(&self, cb: Box<dyn FnMut(&ClockTick)>);
fn run(&self, running: Arc<AtomicBool>) -> IoResult<()>;
fn stop(&self) -> IoResult<()>;
// Provided methods
fn set_input_process_callback(&self, _cb: Box<dyn FnMut(&ClockTick)>) { ... }
fn as_control(&self) -> Option<&dyn IoControl> { ... }
}Expand description
A backend that can be the clock driver for the signal graph.
The driver owns the timing loop: it registers a process callback and fires it on every I/O tick. Only one driver is active per rack.
A single backend struct may implement IoDriver together with
IoCapture and/or IoPlayback — capturing and playing are
orthogonal capabilities on top of the driver role.
Required Methods§
Sourcefn set_process_callback(&self, cb: Box<dyn FnMut(&ClockTick)>)
fn set_process_callback(&self, cb: Box<dyn FnMut(&ClockTick)>)
Register the process callback that the driver calls each tick.
The callback receives a ClockTick with timing metadata
(sample position, rate, speed_ratio, etc.).
Sourcefn run(&self, running: Arc<AtomicBool>) -> IoResult<()>
fn run(&self, running: Arc<AtomicBool>) -> IoResult<()>
Enter the I/O lifecycle. Called on the pre-created signal thread.
For poll-driven backends (ALSA, PipeWire) this blocks inside the
I/O loop and returns only after running becomes false.
For callback-driven backends (JACK, PortAudio) it sets up the
stream and returns immediately — the process callback fires on
the I/O API’s own thread.
Provided Methods§
Sourcefn set_input_process_callback(&self, _cb: Box<dyn FnMut(&ClockTick)>)
fn set_input_process_callback(&self, _cb: Box<dyn FnMut(&ClockTick)>)
Register an optional input-stream callback for split-chain backends (e.g. PipeWire full-duplex).
When both input and output streams exist, the recording chain
(Source → WriteHead) is driven from this callback, while the
playback chain (ReadHeads → Sink) is driven from
[set_process_callback]. Default no-op for single-stream backends.
Sourcefn as_control(&self) -> Option<&dyn IoControl>
fn as_control(&self) -> Option<&dyn IoControl>
Returns a control interface if this driver supports runtime
register/data writes. Returns None by default.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".