pub trait PacketResamplerBuffer<T: Sample> {
type Output: ?Sized;
// Required methods
fn new(channels: usize, input_frames: usize, output_frames: usize) -> Self;
fn output(&self, frames: usize) -> &Self::Output;
fn resample(
&mut self,
indexing: Option<&Indexing>,
resampler: &mut Box<dyn Resampler<T>>,
) -> ResampleResult<(usize, usize)>;
fn copy_from_other_to_input_channel(
&mut self,
other: &dyn Adapter<'_, T>,
other_channel: usize,
self_channel: usize,
other_skip: usize,
self_skip: usize,
take: usize,
) -> Option<usize>;
fn input_fill_frames_with(
&mut self,
start: usize,
count: usize,
value: &T,
) -> Option<usize>;
fn input_fill_with(&mut self, value: &T);
fn output_copy_frames_within(
&mut self,
src: usize,
dest: usize,
count: usize,
);
}Expand description
The type of output buffer to use for a PacketResampler.
The provided options are Sequential and Interleaved.
Required Associated Types§
Required Methods§
fn new(channels: usize, input_frames: usize, output_frames: usize) -> Self
fn output(&self, frames: usize) -> &Self::Output
fn resample( &mut self, indexing: Option<&Indexing>, resampler: &mut Box<dyn Resampler<T>>, ) -> ResampleResult<(usize, usize)>
Sourcefn copy_from_other_to_input_channel(
&mut self,
other: &dyn Adapter<'_, T>,
other_channel: usize,
self_channel: usize,
other_skip: usize,
self_skip: usize,
take: usize,
) -> Option<usize>
fn copy_from_other_to_input_channel( &mut self, other: &dyn Adapter<'_, T>, other_channel: usize, self_channel: usize, other_skip: usize, self_skip: usize, take: usize, ) -> Option<usize>
Copy values from a channel of another Adapter.
The self_skip and other_skip arguments are the offsets
in frames for where copying starts in the two channels.
The method copies take values.
Returns the the number of values that were clipped during conversion. Implementations that do not perform any conversion always return zero clipped samples.
If an invalid channel number is given,
or if either of the channels is to short to copy take values,
no values will be copied and None is returned.
Sourcefn input_fill_frames_with(
&mut self,
start: usize,
count: usize,
value: &T,
) -> Option<usize>
fn input_fill_frames_with( &mut self, start: usize, count: usize, value: &T, ) -> Option<usize>
Write the provided value to every sample in a range of frames.
Can be used to clear a range of frames by writing zeroes,
or to initialize each sample to a certain value.
Returns None if called with a too large range.
Sourcefn input_fill_with(&mut self, value: &T)
fn input_fill_with(&mut self, value: &T)
Write the provided value to every sample in the entire buffer. Can be used to clear a buffer by writing zeroes, or to initialize each sample to a certain value.
Sourcefn output_copy_frames_within(&mut self, src: usize, dest: usize, count: usize)
fn output_copy_frames_within(&mut self, src: usize, dest: usize, count: usize)
Copy frames within the buffer.
Copying is performed for all channels.
Copies count frames, from the range src..src+count,
to the range dest..dest+count.
The two regions are allowed to overlap.
The default implementation copies by calling the read and write methods,
while type specific implementations can use more efficient methods.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.