Struct MetricsAccumulator
pub struct MetricsAccumulator { /* private fields */ }Expand description
Accumulates per-sample statistics and reduces them to UiMetrics every block.
Used by the audio thread to compute RMS, peak, and tap tube/transformer state.
Call accumulate() every sample, then reduce() every block_size samples.
Implementations§
§impl MetricsAccumulator
impl MetricsAccumulator
pub fn new(block_size: usize) -> MetricsAccumulator
pub fn new(block_size: usize) -> MetricsAccumulator
Create a new accumulator with the given block size.
pub fn set_nominal_supply(&mut self, voltage: f32)
pub fn set_nominal_supply(&mut self, voltage: f32)
Set the nominal supply voltage for sag calculation.
pub fn accumulate_levels(&mut self, input: f64, output: f64)
pub fn accumulate_levels(&mut self, input: f64, output: f64)
Accumulate input/output levels for one sample.
pub fn accumulate_stage(&mut self, stage_idx: usize, level: f64)
pub fn accumulate_stage(&mut self, stage_idx: usize, level: f64)
Record a stage level (call after each WDF stage processes).
pub fn record_stage_solver(
&mut self,
stage_idx: usize,
iterations: u32,
residual: f64,
converged: bool,
)
pub fn record_stage_solver( &mut self, stage_idx: usize, iterations: u32, residual: f64, converged: bool, )
Record one nonlinear/coupled solver call for a stage.
pub fn record_signal_fault(&mut self, value: f64)
pub fn record_signal_fault(&mut self, value: f64)
Record a runtime signal fault caught outside normal level metering.
pub fn record_tube(&mut self, tube_idx: usize, plate_current_ma: f32, vpk: f32)
pub fn record_tube(&mut self, tube_idx: usize, plate_current_ma: f32, vpk: f32)
Record tube state (call once per sample or per block).
pub fn record_supply(&mut self, voltage: f32)
pub fn record_supply(&mut self, voltage: f32)
Record supply voltage (for sag visualization).
pub fn record_lfo_phase(&mut self, phase: f32)
pub fn record_lfo_phase(&mut self, phase: f32)
Record LFO phase (for pulse indicator).
pub fn record_gain_reduction(&mut self, gr_db: f32)
pub fn record_gain_reduction(&mut self, gr_db: f32)
Record gain reduction (for compressor meters).
pub fn is_block_complete(&self) -> bool
pub fn is_block_complete(&self) -> bool
Check if a block is complete and ready for reduction.