pub struct CollectedAudio { /* private fields */ }Expand description
One whole audio extraction, collected: owned, interleaved 32-bit float samples plus the sample rate, channel count, and channel layout that describe them.
Returned by collect_audio. The
buffer is exactly what
collect_samples returns for
the same run — packed native-endian f32, channels interleaved
([L0, R0, L1, R1, …] for stereo) — with the shape attached, so a WAV
writer, resampler, or model can consume the buffer without out-of-band
knowledge of the source.
Implementations§
Source§impl CollectedAudio
impl CollectedAudio
Sourcepub fn sample_rate(&self) -> u32
pub fn sample_rate(&self) -> u32
Samples per second. 0 only when the run delivered no samples at all.
Sourcepub fn channels(&self) -> u16
pub fn channels(&self) -> u16
Number of interleaved channels (1 for mono, 2 for stereo). 0 only
when the run delivered no samples at all.
Sourcepub fn channel_layout(&self) -> &str
pub fn channel_layout(&self) -> &str
FFmpeg’s textual channel-layout description (e.g. "mono",
"stereo", "5.1") — the same vocabulary as
AudioChunk::channel_layout.
Above two channels this distinguishes layouts a bare count cannot
(6 channels may be "5.1" or "6.0"). Empty when the run delivered
no samples, or when FFmpeg cannot describe the layout.