[][src]Struct rubato::FftFixedIn

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

A synchronous resampler that needs a fixed number of audio frames for input and returns a variable number of frames.

The resampling is done by FFT:ing the input data. The spectrum is then extended or truncated as well as multiplied with an antialiasing filter before it's inverse transformed to get the resampled waveforms.

Implementations

impl FftFixedIn<f64>[src]

pub fn new(
    fs_in: usize,
    fs_out: usize,
    chunk_size_in: usize,
    sub_chunks: usize,
    nbr_channels: usize
) -> Self
[src]

Create a new FftFixedOut

Parameters are:

  • fs_in: Input sample rate.
  • fs_out: Output sample rate.
  • chunk_size_out: length of output data in frames.
  • sub_chunks: desired number of subchunks for processing, actual number used may be different.
  • nbr_channels: number of channels in input/output.

impl FftFixedIn<f32>[src]

pub fn new(
    fs_in: usize,
    fs_out: usize,
    chunk_size_in: usize,
    sub_chunks: usize,
    nbr_channels: usize
) -> Self
[src]

Create a new FftFixedOut

Parameters are:

  • fs_in: Input sample rate.
  • fs_out: Output sample rate.
  • chunk_size_out: length of output data in frames.
  • sub_chunks: desired number of subchunks for processing, actual number used may be different.
  • nbr_channels: number of channels in input/output.

Trait Implementations

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

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

Query for the number of frames needed for the next call to "process".

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

Update the resample ratio. This is not supported by this resampler and always returns an error.

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

Update the resample ratio relative to the original one. This is not supported by this resampler and always returns an error.

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

Resample a chunk of audio. The required input length is provided by the "nbr_frames_needed" function, and the output length is fixed.

Errors

The function returns an error if the length of the input data is not equal to the number of channels defined when creating the instance, and the number of audio frames given by "nbr_frames_needed".

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

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

Query for the number of frames needed for the next call to "process".

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

Update the resample ratio. This is not supported by this resampler and always returns an error.

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

Update the resample ratio relative to the original one. This is not supported by this resampler and always returns an error.

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

Resample a chunk of audio. The required input length is provided by the "nbr_frames_needed" function, and the output length is fixed.

Errors

The function returns an error if the length of the input data is not equal to the number of channels defined when creating the instance, and the number of audio frames given by "nbr_frames_needed".

Auto Trait Implementations

impl<T> !RefUnwindSafe for FftFixedIn<T>

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

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

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

impl<T> !UnwindSafe for FftFixedIn<T>

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.