Struct Stereo Oversampler
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
impl StereoOversampler
pub fn new(
factor: OversamplingFactor,
maximum_frames: usize,
) -> Result<Self, OversamplerError>
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
pub fn factor(&self) -> OversamplingFactor
The oversampling factor.
pub fn maximum_frames(&self) -> usize
pub fn maximum_frames(&self) -> usize
Prepared maximum host block length.
pub fn reset(&mut self)
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>
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>
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>
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
impl Clone for StereoOversampler
§fn clone(&self) -> StereoOversampler
fn clone(&self) -> StereoOversampler
1.0.0 (const: unstable) · §fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more