Struct rubato::FftFixedOut
source · [−]pub struct FftFixedOut<T> { /* private fields */ }
Expand description
A synchronous resampler that needs a varying number of audio frames for input and returns a fixed 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
sourceimpl<T> FftFixedOut<T> where
T: Sample,
impl<T> FftFixedOut<T> where
T: Sample,
sourcepub fn new(
sample_rate_input: usize,
sample_rate_output: usize,
chunk_size_out: usize,
sub_chunks: usize,
nbr_channels: usize
) -> Result<Self, ResamplerConstructionError>
pub fn new(
sample_rate_input: usize,
sample_rate_output: usize,
chunk_size_out: usize,
sub_chunks: usize,
nbr_channels: usize
) -> Result<Self, ResamplerConstructionError>
Create a new FftFixedOut
Parameters are:
sample_rate_input
: Input sample rate, must be > 0.sample_rate_output
: Output sample rate, must be > 0.chunk_size_out
: length of output data in frames.sub_chunks
: desired number of subchunks for processing, actual number may be different.nbr_channels
: number of channels in input/output.
Trait Implementations
sourceimpl<T> Resampler<T> for FftFixedOut<T> where
T: Sample,
impl<T> Resampler<T> for FftFixedOut<T> where
T: Sample,
sourcefn set_resample_ratio(&mut self, _new_ratio: f64) -> ResampleResult<()>
fn set_resample_ratio(&mut self, _new_ratio: f64) -> ResampleResult<()>
Update the resample ratio. This is not supported by this resampler and always returns ResampleError::SyncNotAdjustable.
sourcefn 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. This is not supported by this resampler and always returns ResampleError::SyncNotAdjustable.
sourcefn process_into_buffer<V: AsRef<[T]>>(
&mut self,
wave_in: &[V],
wave_out: &mut [Vec<T>],
active_channels_mask: Option<&[bool]>
) -> ResampleResult<()>
fn process_into_buffer<V: AsRef<[T]>>(
&mut self,
wave_in: &[V],
wave_out: &mut [Vec<T>],
active_channels_mask: Option<&[bool]>
) -> ResampleResult<()>
sourcefn input_frames_max(&self) -> usize
fn input_frames_max(&self) -> usize
Get the maximum number of input frames per channel the resampler could require
sourcefn input_frames_next(&self) -> usize
fn input_frames_next(&self) -> usize
Get the number of frames per channel needed for the next call to process_into_buffer or process Read more
sourcefn nbr_channels(&self) -> usize
fn nbr_channels(&self) -> usize
Get the maximum number of channels this Resampler is configured for
sourcefn output_frames_max(&self) -> usize
fn output_frames_max(&self) -> usize
Get the max number of output frames per channel
sourcefn output_frames_next(&self) -> usize
fn output_frames_next(&self) -> usize
Get the number of frames per channel that will be output from the next call to process_into_buffer or process Read more
sourcefn process<V: AsRef<[T]>>(
&mut self,
wave_in: &[V],
active_channels_mask: Option<&[bool]>
) -> ResampleResult<Vec<Vec<T>>>
fn process<V: AsRef<[T]>>(
&mut self,
wave_in: &[V],
active_channels_mask: Option<&[bool]>
) -> ResampleResult<Vec<Vec<T>>>
This is a convenience wrapper for process_into_buffer that allocates the output buffer with each call. For realtime applications, use process_into_buffer with a buffer allocated by output_buffer_allocate instead of this function. Read more
sourcefn input_buffer_allocate(&self) -> Vec<Vec<T>>
fn input_buffer_allocate(&self) -> Vec<Vec<T>>
Convenience method for allocating an input buffer suitable for use with process_into_buffer. The buffer’s capacity is big enough to prevent allocating additional heap memory before any call to process_into_buffer regardless of the current resampling ratio. Read more
sourcefn output_buffer_allocate(&self) -> Vec<Vec<T>>
fn output_buffer_allocate(&self) -> Vec<Vec<T>>
Convenience method for allocating an output buffer suitable for use with process_into_buffer. The buffer’s capacity is big enough to prevent allocating additional heap memory during any call to process_into_buffer regardless of the current resampling ratio. Read more
Auto Trait Implementations
impl<T> !RefUnwindSafe for FftFixedOut<T>
impl<T> Send for FftFixedOut<T> where
T: Send,
impl<T> Sync for FftFixedOut<T> where
T: Sync,
impl<T> Unpin for FftFixedOut<T> where
T: Unpin,
impl<T> !UnwindSafe for FftFixedOut<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T, U> VecResampler<T> for U where
U: Resampler<T>,
impl<T, U> VecResampler<T> for U where
U: Resampler<T>,
sourcefn process(
&mut self,
wave_in: &[Vec<T, Global>],
active_channels_mask: Option<&[bool]>
) -> Result<Vec<Vec<T, Global>, Global>, ResampleError>
fn process(
&mut self,
wave_in: &[Vec<T, Global>],
active_channels_mask: Option<&[bool]>
) -> Result<Vec<Vec<T, Global>, Global>, ResampleError>
Refer to Resampler::process
sourcefn process_into_buffer(
&mut self,
wave_in: &[Vec<T, Global>],
wave_out: &mut [Vec<T, Global>],
active_channels_mask: Option<&[bool]>
) -> Result<(), ResampleError>
fn process_into_buffer(
&mut self,
wave_in: &[Vec<T, Global>],
wave_out: &mut [Vec<T, Global>],
active_channels_mask: Option<&[bool]>
) -> Result<(), ResampleError>
Refer to Resampler::process_into_buffer
sourcefn output_buffer_allocate(&self) -> Vec<Vec<T, Global>, Global>
fn output_buffer_allocate(&self) -> Vec<Vec<T, Global>, Global>
Refer to Resampler::output_buffer_allocate
sourcefn output_frames_next(&self) -> usize
fn output_frames_next(&self) -> usize
Refer to Resampler::output_frames_next
sourcefn output_frames_max(&self) -> usize
fn output_frames_max(&self) -> usize
Refer to Resampler::output_frames_max
sourcefn input_frames_next(&self) -> usize
fn input_frames_next(&self) -> usize
Refer to Resampler::input_frames_next
sourcefn nbr_channels(&self) -> usize
fn nbr_channels(&self) -> usize
Refer to Resampler::nbr_channels
sourcefn input_frames_max(&self) -> usize
fn input_frames_max(&self) -> usize
Refer to Resampler::input_frames_max
sourcefn input_buffer_allocate(&self) -> Vec<Vec<T, Global>, Global>
fn input_buffer_allocate(&self) -> Vec<Vec<T, Global>, Global>
Refer to Resampler::input_buffer_allocate
sourcefn set_resample_ratio(&mut self, new_ratio: f64) -> Result<(), ResampleError>
fn set_resample_ratio(&mut self, new_ratio: f64) -> Result<(), ResampleError>
Refer to Resampler::set_resample_ratio