[−][src]Struct rubato::SincFixedOut
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
impl<T: Float> SincFixedOut<T>
[src]
pub fn new(
resample_ratio: f64,
parameters: InterpolationParameters,
chunk_size: usize,
nbr_channels: usize
) -> Self
[src]
resample_ratio: f64,
parameters: InterpolationParameters,
chunk_size: usize,
nbr_channels: usize
) -> Self
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
Trait Implementations
impl Resampler<f32> for SincFixedOut<f32>
[src]
pub fn nbr_frames_needed(&self) -> usize
[src]
Query for the number of frames needed for the next call to "process".
pub fn set_resample_ratio(
&mut self,
new_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]
&mut self,
new_ratio: f64
) -> Result<(), Box<dyn Error>>
Update the resample ratio. New value must be within +-10% of the original one
pub fn set_resample_ratio_relative(
&mut self,
rel_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]
&mut self,
rel_ratio: f64
) -> Result<(), Box<dyn Error>>
Update the resample ratio relative to the original one
pub fn process(
&mut self,
wave_in: &[Vec<f32>]
) -> Result<Vec<Vec<f32>>, Box<dyn Error>>
[src]
&mut self,
wave_in: &[Vec<f32>]
) -> Result<Vec<Vec<f32>>, Box<dyn Error>>
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".
impl Resampler<f64> for SincFixedOut<f64>
[src]
pub fn nbr_frames_needed(&self) -> usize
[src]
Query for the number of frames needed for the next call to "process".
pub fn set_resample_ratio(
&mut self,
new_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]
&mut self,
new_ratio: f64
) -> Result<(), Box<dyn Error>>
Update the resample ratio. New value must be within +-10% of the original one
pub fn set_resample_ratio_relative(
&mut self,
rel_ratio: f64
) -> Result<(), Box<dyn Error>>
[src]
&mut self,
rel_ratio: f64
) -> Result<(), Box<dyn Error>>
Update the resample ratio relative to the original one
pub fn process(
&mut self,
wave_in: &[Vec<f64>]
) -> Result<Vec<Vec<f64>>, Box<dyn Error>>
[src]
&mut self,
wave_in: &[Vec<f64>]
) -> Result<Vec<Vec<f64>>, Box<dyn Error>>
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".
Auto Trait Implementations
impl<T> RefUnwindSafe for SincFixedOut<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for SincFixedOut<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for SincFixedOut<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for SincFixedOut<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for SincFixedOut<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,