AUDIO
Source snapshot · 11 November 2026

API reference / ravet_signal::StereoOversampler

Struct StereoOversampler 

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

Prepared stereo 1×/2×/4×/8× oversampling over whole blocks.

Uses the same fixed polyphase half-band IIR stages as crate::HalfBand2x and crate::Oversampler, and produces bit-identical samples to one crate::Oversampler per channel with the same per-sample processing. It works stage by stage over a block, with both channels in the same loop, which removes per-sample closure and staging overhead.

Preparation allocates high-rate buffers for maximum_frames host frames; StereoOversampler::upsample, StereoOversampler::downsample, StereoOversampler::process and reset never allocate. The IIR stages add frequency-dependent delay; no constant integer latency is reported and the dry path is not aligned. Process high-rate DSP at the host rate times StereoOversampler::factor.

Implementations§

§

impl StereoOversampler

pub fn new( factor: OversamplingFactor, maximum_frames: usize, ) -> Result<Self, OversamplerError>

Prepare for host blocks of up to maximum_frames (1..=65,536).

pub fn factor(&self) -> OversamplingFactor

The oversampling factor.

pub fn maximum_frames(&self) -> usize

Prepared maximum host block length.

pub fn reset(&mut self)

Clear filter state and forget the last upsampled block.

pub fn upsample( &mut self, left: &[f32], right: &[f32], ) -> Result<[&mut [f32]; 2], OversamplerError>

Upsample one host block and return the high-rate left and right buffers, factor times longer, for in-place processing.

pub fn downsample( &mut self, left: &mut [f32], right: &mut [f32], ) -> Result<(), OversamplerError>

Decimate the high-rate buffers of the last StereoOversampler::upsample call into host-rate outputs whose length equals that block.

pub fn process( &mut self, left: &mut [f32], right: &mut [f32], process: impl FnMut(&mut [f32], &mut [f32]), ) -> Result<(), OversamplerError>

Upsample, call process once per prepared-size piece with the high-rate left and right buffers, and decimate back in place. Blocks of any length are accepted; channels of different lengths reject before any change.

Trait Implementations§

§

impl Clone for StereoOversampler

§

fn clone(&self) -> StereoOversampler

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · §

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for StereoOversampler

§

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> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

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.