Skip to main content

Patch

Trait Patch 

Source
pub trait Patch {
    // Provided methods
    fn init(&mut self) { ... }
    fn set_working_buffer(&mut self, _buffer: &'static mut [f32]) { ... }
    fn process_audio(&mut self, _left: &mut [f32], _right: &mut [f32]) -> f32 { ... }
    fn param_metadata(&self, _param: ParamId) -> ParameterMetadata { ... }
    fn set_param(&mut self, _param: ParamId, _value: f32) { ... }
    fn handle_action(&mut self, _action: ActionId) { ... }
    fn state_led_color(&self) -> Color { ... }
}
Expand description

Trait implemented by Endless effect patches.

All methods have default (no-op) implementations so you only need to override the ones your effect requires. At minimum you’ll want process_audio.

Provided Methods§

Source

fn init(&mut self)

Called once at patch load time.

Source

fn set_working_buffer(&mut self, _buffer: &'static mut [f32])

Called once to provide the external working buffer.

This buffer lives in external RAM with higher access latency. The slice length is WORKING_BUFFER_SIZE.

Source

fn process_audio(&mut self, _left: &mut [f32], _right: &mut [f32]) -> f32

Process audio buffers in-place. Called repeatedly from the audio thread.

left and right are guaranteed to have equal length. Keep output samples in the range (-1.0, 1.0) to avoid digital clipping.

The return value is passed back to the firmware (typically 0.0).

Source

fn param_metadata(&self, _param: ParamId) -> ParameterMetadata

Return metadata for the given parameter.

Source

fn set_param(&mut self, _param: ParamId, _value: f32)

Called when a knob value changes. Runs on the audio thread.

Source

fn handle_action(&mut self, _action: ActionId)

Called when a foot-switch action fires.

Source

fn state_led_color(&self) -> Color

Return the current LED color.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§