Skip to main content

Processor

Trait Processor 

Source
pub trait Processor: Send {
    // Required methods
    fn prepare(&mut self, cfg: PrepareConfig);
    fn reset(&mut self);
    fn process(&mut self, block: &mut ProcessBlock<'_>);

    // Provided methods
    fn clock_domain(&self) -> ClockDomain { ... }
    fn latency_class(&self) -> LatencyClass { ... }
    fn realtime_pin(&self) -> bool { ... }
    fn ports(&self, in_channels: u16, out_channels: u16) -> Vec<PortDecl> { ... }
    fn descriptor(
        &self,
        in_channels: u16,
        out_channels: u16,
    ) -> ProcessorDescriptor { ... }
    fn tail_frames(&self) -> u64 { ... }
}
Expand description

A node behavior in the audio graph: prepared once, then processes blocks.

Implementors must supply prepare, reset, and process; the remaining methods describe clocking, latency, and ports and have sensible defaults (sample-rate audio, block-local latency, realtime-pinned).

Required Methods§

Source

fn prepare(&mut self, cfg: PrepareConfig)

Prepares the processor for a sample rate, block size, and channel layout.

Source

fn reset(&mut self)

Clears any internal state to a fresh start.

Source

fn process(&mut self, block: &mut ProcessBlock<'_>)

Processes one block of audio and events in place.

Provided Methods§

Source

fn clock_domain(&self) -> ClockDomain

Returns the processor’s clock domain (defaults to sample rate).

Source

fn latency_class(&self) -> LatencyClass

Returns the processor’s latency class (defaults to block-local).

Source

fn realtime_pin(&self) -> bool

Returns whether the processor must run in the realtime thread (defaults to true).

Source

fn ports(&self, in_channels: u16, out_channels: u16) -> Vec<PortDecl>

Returns the processor’s port declarations for the given channel counts (defaults to a single audio in/out pair).

Source

fn descriptor(&self, in_channels: u16, out_channels: u16) -> ProcessorDescriptor

Returns the full ProcessorDescriptor assembled from this processor’s clock, latency, pinning, and ports.

Source

fn tail_frames(&self) -> u64

Returns the processor’s release tail length in frames (defaults to 0).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§