Struct rubato::SincFixedOut [−][src]
pub struct SincFixedOut<T> { /* fields omitted */ }
Expand description
An asynchronous resampler that return a fixed number of audio frames. The number of input frames required is given by the frames_needed function.
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
Create a new SincFixedOut
Parameters are:
resample_ratio
: Ratio between output and input sample rates.parameters
: Parameters for interpolation, seeInterpolationParameters
chunk_size
: size of output 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
pub fn new_with_interpolator(
resample_ratio: f64,
interpolation_type: InterpolationType,
interpolator: Box<dyn SincInterpolator<T>>,
chunk_size: usize,
nbr_channels: usize
) -> Self
Create a new SincFixedOut 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
Query for the number of frames needed for the next call to “process”.
Resample a chunk of audio. The required input length is provided by the “nbr_frames_needed” function, and the output length is fixed. 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 defined when creating the instance, and the number of audio frames given by “nbr_frames_needed”.
Update the resample ratio. New value must be within +-10% of the original one
Update the resample ratio relative to the original one