[][src]Struct rubato::SincFixedIn

pub struct SincFixedIn<T> { /* fields omitted */ }

An asynchronous resampler that accepts a fixed number of audio frames for input and returns a variable number of frames.

The resampling is done by creating a number of intermediate points (defined by oversampling_factor) by sinc interpolation. The new samples are then calculated by interpolating between these points.

Implementations

impl<T: Float> SincFixedIn<T>[src]

pub fn new(
    resample_ratio: f64,
    parameters: InterpolationParameters,
    chunk_size: usize,
    nbr_channels: usize
) -> Self
[src]

Create a new SincFixedIn

Parameters are:

  • resample_ratio: Ratio between output and input sample rates.
  • parameters: Parameters for interpolation, see InterpolationParameters
  • chunk_size: size of input data in frames
  • nbr_channels: number of channels in input/output

Trait Implementations

impl Resampler<f32> for SincFixedIn<f32>[src]

fn process(
    &mut self,
    wave_in: &[Vec<f32>]
) -> Result<Vec<Vec<f32>>, Box<dyn Error>>
[src]

Resample a chunk of audio. The input length is fixed, and the output varies in length.

Errors

The function returns an error if the length of the input data is not equal to the number of channels and chunk size defined when creating the instance.

fn set_resample_ratio(&mut self, new_ratio: f64) -> Result<(), Box<dyn Error>>[src]

Update the resample ratio. New value must be within +-10% of the original one

fn set_resample_ratio_relative(
    &mut self,
    rel_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio relative to the original one

fn nbr_frames_needed(&self) -> usize[src]

Query for the number of frames needed for the next call to "process". Will always return the chunk_size defined when creating the instance.

impl Resampler<f64> for SincFixedIn<f64>[src]

fn process(
    &mut self,
    wave_in: &[Vec<f64>]
) -> Result<Vec<Vec<f64>>, Box<dyn Error>>
[src]

Resample a chunk of audio. The input length is fixed, and the output varies in length.

Errors

The function returns an error if the length of the input data is not equal to the number of channels and chunk size defined when creating the instance.

fn set_resample_ratio(&mut self, new_ratio: f64) -> Result<(), Box<dyn Error>>[src]

Update the resample ratio. New value must be within +-10% of the original one

fn set_resample_ratio_relative(
    &mut self,
    rel_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]

Update the resample ratio relative to the original one

fn nbr_frames_needed(&self) -> usize[src]

Query for the number of frames needed for the next call to "process". Will always return the chunk_size defined when creating the instance.

Auto Trait Implementations

impl<T> RefUnwindSafe for SincFixedIn<T> where
    T: RefUnwindSafe

impl<T> Send for SincFixedIn<T> where
    T: Send

impl<T> Sync for SincFixedIn<T> where
    T: Sync

impl<T> Unpin for SincFixedIn<T> where
    T: Unpin

impl<T> UnwindSafe for SincFixedIn<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.