Struct rubato::SincFixedIn [−][src]
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> SincFixedIn<T> where
T: Sample,
[src]
impl<T> SincFixedIn<T> where
T: Sample,
[src]pub fn new(
resample_ratio: f64,
parameters: InterpolationParameters,
chunk_size: usize,
nbr_channels: usize
) -> Self
[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, seeInterpolationParameters
chunk_size
: size of input data in framesnbr_channels
: number of channels in input/output
pub fn new_with_interpolator(
resample_ratio: f64,
interpolation_type: InterpolationType,
interpolator: Box<dyn SincInterpolator<T>>,
chunk_size: usize,
nbr_channels: usize
) -> Self
[src]
pub fn new_with_interpolator(
resample_ratio: f64,
interpolation_type: InterpolationType,
interpolator: Box<dyn SincInterpolator<T>>,
chunk_size: usize,
nbr_channels: usize
) -> Self
[src]Create a new SincFixedIn using an existing Interpolator
Parameters are:
resample_ratio
: Ratio between output and input sample rates.interpolation_type
: Parameters for interpolation, seeInterpolationParameters
interpolator
: The interpolator to usechunk_size
: size of output data in framesnbr_channels
: number of channels in input/output
Trait Implementations
impl<T> Resampler<T> for SincFixedIn<T> where
T: Sample,
[src]
impl<T> Resampler<T> for SincFixedIn<T> where
T: Sample,
[src]fn process(&mut self, wave_in: &[Vec<T>]) -> ResampleResult<Vec<Vec<T>>>
[src]
fn process(&mut self, wave_in: &[Vec<T>]) -> ResampleResult<Vec<Vec<T>>>
[src]Resample a chunk of audio. The input length is fixed, and the output varies in length. If the waveform for a channel is empty, this channel will be ignored and produce a corresponding empty output waveform.
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 nbr_frames_needed(&self) -> usize
[src]
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.
fn set_resample_ratio(&mut self, new_ratio: f64) -> ResampleResult<()>
[src]
fn set_resample_ratio(&mut self, new_ratio: f64) -> ResampleResult<()>
[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) -> ResampleResult<()>
[src]
fn set_resample_ratio_relative(&mut self, rel_ratio: f64) -> ResampleResult<()>
[src]Update the resample ratio relative to the original one
Auto Trait Implementations
impl<T> !RefUnwindSafe for SincFixedIn<T>
impl<T> !Send for SincFixedIn<T>
impl<T> !Sync for SincFixedIn<T>
impl<T> Unpin for SincFixedIn<T> where
T: Unpin,
T: Unpin,