Skip to main content

Modulator

Trait Modulator 

Source
pub trait Modulator: Send {
    // Required methods
    fn update(&mut self, dt: f64, info: &Info<'_>);
    fn value(&self) -> f64;
    fn finished(&self) -> bool;

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

Produces a stream of values that a parameter can be linked to.

Required Methods§

Source

fn update(&mut self, dt: f64, info: &Info<'_>)

Updates the modulator.

dt is the time that’s elapsed since the previous round of processing (in seconds).

Source

fn value(&self) -> f64

Returns the current output of the modulator.

Source

fn finished(&self) -> bool

Whether the modulator can be removed from the audio context.

Provided Methods§

Source

fn on_start_processing(&mut self)

Called whenever a new batch of audio samples is requested by the backend.

This is a good place to put code that needs to run fairly frequently, but not for every single audio sample.

Implementors§