Skip to main content

Dsp

Trait Dsp 

Source
pub trait Dsp<S> {
    // Required methods
    fn gain(&mut self, input: &[S], level: u8, output: &mut [S]);
    fn mix(&mut self, left: &[S], right: &[S], output: &mut [S]);
}
Expand description

A target can implement these operations with its own DSP kernels. Each slice has the same frame count and the output is distinct from the inputs. Calls must finish within the audio deadline and fully overwrite the output.

Required Methods§

Source

fn gain(&mut self, input: &[S], level: u8, output: &mut [S])

Scale by level / 128 and saturate to the sample format’s nominal range. For fixed-point PCM, round toward negative infinity.

Source

fn mix(&mut self, left: &[S], right: &[S], output: &mut [S])

Add two signals and saturate to the nominal sample range.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§