Trait PedalProcessor
pub trait PedalProcessor {
// Required methods
fn process(&mut self, input: f64) -> f64;
fn set_sample_rate(&mut self, rate: f64);
fn reset(&mut self);
// Provided methods
fn set_control(&mut self, _label: &str, _value: f64) { ... }
fn set_supply_voltage(&mut self, _voltage: f64) { ... }
fn resolve_port(&self, _name: &str) -> Option<usize> { ... }
fn port_count(&self) -> usize { ... }
fn process_ports(&mut self, _ports: &mut [f64]) { ... }
fn list_editable_components(&self) -> Vec<(String, &'static str, f64)> { ... }
fn set_passive(&mut self, _comp_id: &str, _value: f64) -> bool { ... }
fn reset_passive(&mut self, _comp_id: &str) -> bool { ... }
fn control_debug_info(&self) -> Vec<(String, f64, f64)> { ... }
}Expand description
Audio processor trait for pedals — re-exported from pedalkernel-rt. Audio processor trait for pedals.
Required Methods§
fn set_sample_rate(&mut self, rate: f64)
fn set_sample_rate(&mut self, rate: f64)
Set sample rate (call before processing).
fn reset(&mut self)
fn reset(&mut self)
Reset all internal state.
Provided Methods§
fn set_control(&mut self, _label: &str, _value: f64)
fn set_control(&mut self, _label: &str, _value: f64)
Set a named control parameter (0.0-1.0). Default: no-op.
fn set_supply_voltage(&mut self, _voltage: f64)
fn set_supply_voltage(&mut self, _voltage: f64)
Set supply voltage in volts (default 9.0).
fn resolve_port(&self, _name: &str) -> Option<usize>
fn resolve_port(&self, _name: &str) -> Option<usize>
Resolve a port name to its index in the ports slice. Call once at init to cache indices.
fn port_count(&self) -> usize
fn port_count(&self) -> usize
Number of declared ports (for allocating the ports slice).
fn process_ports(&mut self, _ports: &mut [f64])
fn process_ports(&mut self, _ports: &mut [f64])
Process one sample with named port I/O.
ports is a mutable slice indexed by port index (from resolve_port).
Write input port values before calling. Read output port values after.
All ports are voltages. Audio rate, no impedance recompute.
let mut ports = vec![0.0; filter.port_count()];
ports[audio_in] = input_sample;
ports[cv_cutoff] = envelope_value;
filter.process_ports(&mut ports);
let output = ports[audio_out];fn list_editable_components(&self) -> Vec<(String, &'static str, f64)>
fn list_editable_components(&self) -> Vec<(String, &'static str, f64)>
List all editable passive components (R, C, L with comp_ids). Returns (comp_id, kind_str, current_value) for each editable leaf.
fn set_passive(&mut self, _comp_id: &str, _value: f64) -> bool
fn set_passive(&mut self, _comp_id: &str, _value: f64) -> bool
Set a passive component’s value by comp_id. Returns true if found.
fn reset_passive(&mut self, _comp_id: &str) -> bool
fn reset_passive(&mut self, _comp_id: &str) -> bool
Reset a passive component to its original value. Returns true if found.
fn control_debug_info(&self) -> Vec<(String, f64, f64)>
fn control_debug_info(&self) -> Vec<(String, f64, f64)>
Debug: return current control state as (label, target_value, smoothed_value).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".