Skip to main content

Processor

Trait Processor 

Source
pub trait Processor: Send {
    // Required methods
    fn prepare(&mut self, sample_rate: u32, max_block: usize);
    fn process(
        &mut self,
        ctx: &ProcessCtx,
        inputs: &[&[f32]],
        outputs: &mut [&mut [f32]],
    );
    fn reset(&mut self);
    fn save_state(&self) -> StateBlob;
    fn load_state(&mut self, state: &StateBlob) -> Result<(), StateError>;

    // Provided methods
    fn inputs_per_output(&self) -> usize { ... }
    fn latency_samples(&self) -> u32 { ... }
    fn history_samples(&self) -> u32 { ... }
}
Expand description

Stateful DSP unit whose process method performs no allocation or locking.

Required Methods§

Source

fn prepare(&mut self, sample_rate: u32, max_block: usize)

Configures non-real-time state before processing begins.

Source

fn process( &mut self, ctx: &ProcessCtx, inputs: &[&[f32]], outputs: &mut [&mut [f32]], )

Processes planar channel slices supplied by the host.

A processor with one input per output writes every sample of each output that has an input, up to the shortest, since a crate::ProcessorChain feeds it to the next node.

Source

fn reset(&mut self)

Clears signal history without changing authored parameters.

Source

fn save_state(&self) -> StateBlob

Serializes history at an offline chunk boundary.

Source

fn load_state(&mut self, state: &StateBlob) -> Result<(), StateError>

Restores history saved by a processor of the same type and preparation, atomically.

A processor’s own saved state must always load, since crate::ProcessorChain relies on it to roll back.

§Errors

Returns StateError, leaving the processor unchanged.

Provided Methods§

Source

fn inputs_per_output(&self) -> usize

Input channels read per output channel: 1 for an effect, 2 with a second bus (sidechain or crossfade). A crate::ProcessorChain accepts only processors that read one.

Source

fn latency_samples(&self) -> u32

Algorithmic delay that the graph host must compensate.

Source

fn history_samples(&self) -> u32

Additional source history for a cold seek, excluding algorithmic delay. For recursive processors this approximates uninterrupted playback rather than matching it bit for bit.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§