pub enum BlockLayout {
Interleaved,
Planar,
Sequential,
}Expand description
Represents the memory layout of audio data returned by AudioBlock::layout.
This enum allows consumers to determine the underlying data layout, which is essential for:
- Direct raw data access
- Performance optimizations
- Efficient interfacing with external audio APIs
§Examples of layouts
Each variant represents a common pattern used in audio processing.
Variants§
Interleaved
Samples from different channels alternate in sequence.
Format: [ch0, ch1, ..., ch0, ch1, ..., ch0, ch1, ...]
This layout is common in consumer audio formats and some APIs.
Planar
Channels are separated into discrete chunks of memory.
Format: [[ch0, ch0, ch0, ...], [ch1, ch1, ch1, ...]]
Useful for operations that work on one channel at a time.
Sequential
All samples from one channel appear consecutively before the next channel.
Format: [ch0, ch0, ch0, ..., ch1, ch1, ch1, ...]
Note: Unlike Planar, this uses a single contiguous buffer rather than separate buffers per channel.