pub struct LinearResampler { /* private fields */ }Expand description
Linear interpolation from in_rate to out_rate over up to
MAX_CHANNELS channels of i16.
The phase is a rational number: with the rates reduced by their gcd to
in_r : out_r, output frame k sits at input position k·in_r/out_r
exactly, so 16 k → 48 k lands every third output on an input sample and
the long-run rate error is zero. The interpolation is
y = x0 + ((x1 − x0)·frac_q32 + 2^31) >> 32 with frac_q32 = (rem << 32) / out_r. The last frame of each block is kept so blocks join
seamlessly; output frames that need the next block wait for it. Same-rate
setups are a byte-exact copy.
Implementations§
Trait Implementations§
Source§impl Clone for LinearResampler
impl Clone for LinearResampler
Source§fn clone(&self) -> LinearResampler
fn clone(&self) -> LinearResampler
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LinearResampler
impl Debug for LinearResampler
Source§impl Element for LinearResampler
impl Element for LinearResampler
Source§fn output_format(&self, input: PcmFormat) -> Result<PcmFormat>
fn output_format(&self, input: PcmFormat) -> Result<PcmFormat>
The format this element emits for blocks in
input, or
Err(Unsupported) if it cannot take input at all.Source§fn max_output_bytes(&self, input: PcmFormat, input_bytes: usize) -> usize
fn max_output_bytes(&self, input: PcmFormat, input_bytes: usize) -> usize
Upper bound on the bytes
process writes for an input
block of input_bytes bytes in input. Defaults to input_bytes
(same-size elements); resamplers and channel converters override it.Auto Trait Implementations§
impl Freeze for LinearResampler
impl RefUnwindSafe for LinearResampler
impl Send for LinearResampler
impl Sync for LinearResampler
impl Unpin for LinearResampler
impl UnsafeUnpin for LinearResampler
impl UnwindSafe for LinearResampler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more