Skip to main content

PedalboardProcessor

Struct PedalboardProcessor 

Source
pub struct PedalboardProcessor { /* private fields */ }
Expand description

Chains N CompiledPedal instances in series, with optional FX loop groups.

When impedance loading is enabled, interstage loading models are inserted between adjacent pedals to simulate the electrical interaction between source and load impedances.

Implementations§

Source§

impl PedalboardProcessor

Source

pub fn from_board( board: &BoardDef, board_dir: &Path, sample_rate: f64, ) -> Result<Self, String>

Build a pedalboard from a parsed .board definition.

Each .pedal file is read relative to board_dir, compiled at the given sample rate, and any knob overrides from the board file are applied.

If a pedal fails to load or compile, it is replaced with a dry passthrough slot and a warning is emitted to stderr. The board still loads — only the broken pedal is silent.

Source

pub fn from_board_with_warnings( board: &BoardDef, board_dir: &Path, sample_rate: f64, ) -> (Self, Vec<String>)

Build a pedalboard, returning both the processor and any warnings.

Pedals that fail to read, parse, or compile are replaced with dry passthrough slots. The returned warnings describe each failure.

If a .global.board file is found (by walking up from board_dir), its start pedals are prepended and end pedals are appended to the signal chain.

Source

pub fn from_board_with_resolver( board: &BoardDef, sample_rate: f64, resolver: impl Fn(&str) -> Option<String>, ) -> (Self, Vec<String>)

Build a pedalboard from a parsed .board definition, using a resolver function instead of filesystem reads.

The resolver takes a pedal path string (as written in the .board file) and returns the .pedal source text. This allows building boards from include_str!’d sources without any filesystem access — useful for embedded/factory boards in the VST plugin.

Global boards and FX loops are not supported in resolver mode (boards referencing FX loops should use [from_board_with_warnings] instead).

Source

pub fn len(&self) -> usize

Number of pedals in the chain (flattened, including FX loop contents).

Source

pub fn is_empty(&self) -> bool

Whether the pedalboard is empty.

Source

pub fn pedal_name(&self, index: usize) -> Option<&str>

Get the name of pedal at the given flat index.

Source

pub fn is_pedal_bypassed(&self, index: usize) -> bool

Check if a pedal is bypassed.

Source

pub fn is_pedal_failed(&self, index: usize) -> bool

Check if a pedal slot failed to compile (dry passthrough).

Source

pub fn set_interstage_loading( &mut self, junction_index: usize, source: ImpedanceModel, load: ImpedanceModel, sample_rate: f64, )

Configure the impedance loading between two adjacent pedals.

junction_index is the junction between chain[junction_index] and chain[junction_index + 1]. The source describes the output impedance of the preceding pedal, and load describes the input impedance of the following pedal.

This models the electrical interaction that causes real pedals to sound different depending on what’s connected before/after them. For example, a Fuzz Face after a buffered pedal sounds different than directly after a guitar, because its low input impedance loads the source differently.

Source

pub fn input_impedance(&self) -> f64

Get the input impedance of the pedalboard (Ω).

Returns the input impedance of the first pedal in the chain. If the chain is empty or the first pedal has no processor, returns high-Z (1MΩ).

Source

pub fn output_impedance(&self) -> f64

Get the output impedance of the pedalboard (Ω).

Returns the output impedance of the last pedal in the chain. If the chain is empty or the last pedal has no processor, returns low-Z (1kΩ).

Trait Implementations§

Source§

impl PedalProcessor for PedalboardProcessor

Source§

fn set_control(&mut self, label: &str, value: Wave)

Control routing: "idx:label" dispatches to the appropriate pedal.

Indices are flat across the board — FX loop pedals are numbered sequentially after pedals before the loop. Special controls:

  • "idx:__bypass__" toggles bypass (value > 0.5 = bypassed)
  • "fx_loop:mix" controls the FX loop wet/dry blend (first loop)
  • "fx_loop_N:mix" controls the Nth FX loop’s mix (0-indexed)
Source§

fn process(&mut self, input: Wave) -> Wave

Process a single sample.
Source§

fn set_sample_rate(&mut self, rate: Wave)

Set sample rate (call before processing).
Source§

fn reset(&mut self)

Reset all internal state.
§

fn set_supply_voltage(&mut self, _voltage: f64)

Set supply voltage in volts (default 9.0).
§

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

Number of declared ports (for allocating the ports slice).
§

fn process_ports(&mut self, _ports: &mut [f64])

Process one sample with named port I/O. Read more
§

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

Set a passive component’s value by comp_id. Returns true if found.
§

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)>

Debug: return current control state as (label, target_value, smoothed_value).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more