Trait rubato::VecResampler
source · [−]pub trait VecResampler<T>: Send {
fn process(&mut self, wave_in: &[Vec<T>]) -> ResampleResult<Vec<Vec<T>>>;
fn nbr_frames_needed(&self) -> usize;
fn set_resample_ratio(&mut self, new_ratio: f64) -> ResampleResult<()>;
fn set_resample_ratio_relative(
&mut self,
rel_ratio: f64
) -> ResampleResult<()>;
}
Expand description
This is a helper trait that can be used when a Resampler must be object safe.
It differs from Resampler only by fixing the type of the input of process()
to &[Vec<T>]
.
This allows it to be made into a trait object like this:
let boxed: Box<dyn VecResampler<f64>> = Box::new(FftFixedIn::<f64>::new(44100, 88200, 1024, 2, 2));
Use this implementation as an example if you need to fix the input type to something else.
Required methods
Resample a chunk of audio. Input and output data is stored in vectors, where each element contains a vector with all samples for a single channel.
fn nbr_frames_needed(&self) -> usize
fn nbr_frames_needed(&self) -> usize
Query for the number of frames needed for the next call to “process”.
fn set_resample_ratio(&mut self, new_ratio: f64) -> ResampleResult<()>
fn set_resample_ratio(&mut self, new_ratio: f64) -> ResampleResult<()>
Update the resample ratio.
fn set_resample_ratio_relative(&mut self, rel_ratio: f64) -> ResampleResult<()>
fn set_resample_ratio_relative(&mut self, rel_ratio: f64) -> ResampleResult<()>
Update the resample ratio relative to the original one.