AUDIO
Source snapshot · 12 October 2026

API reference / ravet_signal::TruePeakBank64

Struct TruePeakBank64 

pub struct TruePeakBank64 { /* private fields */ }
Expand description

Prepared 1..64-channel f64 measurement bank; f32 observation widens exactly.

Each causal phase is at t-half_width+phase/factor after source step t. Negative indices are zero. Live readings have half_width frames of pending source suffix (capped at the accepted source length); explicit finish evaluates the full zero-extended finite support. Artificial tail steps never increment original source frames. Empty finish is empty, repeat finish idempotent, and later input (including empty calls) requires reset.

Entire shape/prefix/frame/count admission precedes any measurement/history mutation. Nonfinite samples are measurement silence with a flag; audio is untouched. Per-window max-absolute scaling and Neumaier summation avoid intermediate overflow and reduce alternating-weight accumulation error; genuine final amplitudes beyond f64::MAX report infinity and an overflow flag. Native underflow/rounding remains observable. No callback heap/locks/I/O or implicit Drop finalization; finish performs bounded 2*half_width steps and belongs after stopped audio ownership. No deadline or conformance guarantee.

A live interpolated_peak is not a peak bound: it can be below sample_peak because the newest half_width source frames have not yet had their own phase-zero coordinate evaluated. Coordinates beyond the last source frame (for example the overshoot after a truncated near-Nyquist run) are only measured by finish(). Coordinates far beyond the last frame only see small window edge weights, so the peak value is not expected to discriminate a tail much longer than half_width steps (an argument, not a proof); the 2*half_width tail is evidenced by the tail_frames, phase_observations and last_phase_numerator() counters rather than by the peak.

Two flags have different meanings. Nonfinite input samples are replaced by zero before measurement (also in sample_peak) and latch nonfinite_input; amplitude_overflow is set only when the final arithmetic result of finite samples exceeds f64::MAX. Flags and peaks are per channel; a poisoned channel leaves its neighbours’ readings and histories unchanged. Channels share nothing but the step counter and a recomputed scratch array.

Implementations§

§

impl TruePeakBank64

pub fn new( design: &TruePeakDesign, channels: usize, maximum_frames: usize, ) -> Result<Self, TruePeakError>

Borrowed design survives any constructor refusal; all allocation is CONTROL.

pub fn design(&self) -> &TruePeakDesign

pub const fn channels(&self) -> usize

pub const fn maximum_frames(&self) -> usize

pub const fn source_frames(&self) -> u64

pub fn last_phase_numerator(&self) -> Option<i128>

Latest fully evaluated phase coordinate numerator, denominator factor.

pub fn pending_source_suffix_frames(&self) -> u64

pub fn reading( &self, channel: usize, ) -> Result<TruePeakReading64, TruePeakError>

pub fn observe_frame(&mut self, input: &[f64]) -> Result<(), TruePeakError>

pub fn observe_frame_f32(&mut self, input: &[f32]) -> Result<(), TruePeakError>

pub fn observe_planar( &mut self, input: &[&[f64]], frames: usize, ) -> Result<(), TruePeakError>

pub fn observe_planar_f32( &mut self, input: &[&[f32]], frames: usize, ) -> Result<(), TruePeakError>

pub fn observe_in_place( &mut self, input: &[&mut [f64]], frames: usize, ) -> Result<(), TruePeakError>

pub fn observe_in_place_f32( &mut self, input: &[&mut [f32]], frames: usize, ) -> Result<(), TruePeakError>

pub fn finish(&mut self)

Explicit stopped finalization; all finite support, no original-frame inflation.

pub fn reset(&mut self)

Trait Implementations§

§

impl Debug for TruePeakBank64

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.