Skip to main content

Waveform

Trait Waveform 

Source
pub trait Waveform {
    type Output: Sample;

    // Required method
    fn sample(&mut self, phase: Phase) -> Self::Output;

    // Provided method
    fn reset(&mut self) { ... }
}
Expand description

Maps oscillator phase to an output value.

Required Associated Types§

Source

type Output: Sample

The type of sample produced: f64 for real waveforms, Complex<f64> for quadrature.

Required Methods§

Source

fn sample(&mut self, phase: Phase) -> Self::Output

The waveform value at phase. Called once per output sample, in order, so stateful waveforms (such as sample-and-hold noise) may keep history.

Provided Methods§

Source

fn reset(&mut self)

Returns any internal state to its starting condition.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§