AUDIO
Source snapshot · 12 October 2026

API reference / ravet_graph::SharedMonoKernel

Trait SharedMonoKernel 

pub trait SharedMonoKernel<S: GraphSample, C> {
    // Required methods
    fn prepare(
        &mut self,
        sample_rate: f64,
        maximum_frames: usize,
        controls: &C,
    ) -> Result<(), PrepareError>;
    fn process_sample(&mut self, input: S, controls: &C) -> S;
    fn reset(&mut self, controls: &C);
    fn deactivate(&mut self);

    // Provided methods
    fn latency_samples(&self) -> u32 { ... }
    fn tail(&self) -> Tail { ... }
}
Expand description

Foreign mono kernel obligations match Processor: finite work, no callback allocation/locks/I/O, prepare failures inactive.

The framework hands every kernel the same &C and never mutates C while kernels are prepared: shared_controls_mut_stopped deactivates first. Shared access rules out overlapping &mut access to C, but it does not make C immutable. If C contains interior mutability (Cell, atomics, locks), a kernel may change what later channels read within the same frame. Keeping C effectively immutable while prepared, or making any interior mutation deterministic and real-time safe, is an implementor obligation that the framework neither checks nor enforces.

Arithmetic policy is likewise the implementor’s: the framework does not filter, clamp, reject or flush nonfinite or denormal samples and does not inspect kernel output.

Required Methods§

fn prepare( &mut self, sample_rate: f64, maximum_frames: usize, controls: &C, ) -> Result<(), PrepareError>

fn process_sample(&mut self, input: S, controls: &C) -> S

fn reset(&mut self, controls: &C)

fn deactivate(&mut self)

Provided Methods§

fn latency_samples(&self) -> u32

fn tail(&self) -> Tail

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§