pub struct Indexing {
pub input_offset: usize,
pub output_offset: usize,
pub partial_len: Option<usize>,
pub active_channels_mask: Option<Vec<bool>>,
}Expand description
A struct for providing optional parameters when calling process_into_buffer.
All fields have sensible defaults: zero offsets, no partial length, and all channels active.
Pass None as the indexing argument to use these defaults without constructing the struct.
Fields§
§input_offset: usizeNumber of frames to skip at the beginning of the input buffer before reading.
Use this to process a sub-region of a larger buffer without copying data.
Defaults to 0 (read from the start of the buffer).
output_offset: usizeNumber of frames to skip at the beginning of the output buffer before writing.
Use this to write results into a sub-region of a larger buffer.
Defaults to 0 (write from the start of the buffer).
partial_len: Option<usize>Set to Some(n) when the input buffer contains fewer valid frames than
Resampler::input_frames_next requires.
The resampler will read the first n frames from the input buffer and
treat the remaining frames as silence.
This is useful for processing the very last (partial) chunk of a stream or audio clip.
Important: even with partial_len set, the output buffer must still be large enough
to hold at least Resampler::output_frames_next frames (plus output_offset),
because the resampler always produces a full output chunk.
Set to Some(0) to process a chunk of pure silence (e.g. to flush the resampler delay).
Defaults to None, meaning the full Resampler::input_frames_next frames are read.
active_channels_mask: Option<Vec<bool>>Optional per-channel processing mask.
When Some(vec), each element corresponds to one channel:
true means the channel is processed normally,
false means the channel is skipped and its output is left unchanged.
When None, all channels are processed.
Implementations§
Source§impl Indexing
impl Indexing
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an Indexing with all fields at their defaults: zero offsets, no partial length, and all channels active.
Chain the setters to configure only the fields you need:
use rubato::Indexing;
let indexing = Indexing::new()
.input_offset(128)
.partial_len(64);Sourcepub fn input_offset(self, frames: usize) -> Self
pub fn input_offset(self, frames: usize) -> Self
Set the number of frames to skip at the start of the input buffer.
Sourcepub fn output_offset(self, frames: usize) -> Self
pub fn output_offset(self, frames: usize) -> Self
Set the number of frames to skip at the start of the output buffer.
Sourcepub fn partial_len(self, frames: usize) -> Self
pub fn partial_len(self, frames: usize) -> Self
Set the number of valid input frames available for a partial (final) chunk.
Sourcepub fn active_channels_mask(self, mask: Vec<bool>) -> Self
pub fn active_channels_mask(self, mask: Vec<bool>) -> Self
Set the per-channel processing mask.