pub struct PcmChunk {
pub pcm: PcmBuf,
pub meta: PcmMeta,
}Expand description
PCM chunk containing interleaved audio samples with automatic pool recycling.
The pcm buffer is pool-backed via PcmBuf: when the chunk is dropped,
the buffer returns to the global PCM pool for reuse instead of being deallocated.
§Invariants
pcm.len() % channels == 0(frame-aligned)spec.channels > 0andspec.sample_rate > 0- All samples are f32 and interleaved (LRLRLR…)
Fields§
§pcm: PcmBuf§meta: PcmMetaImplementations§
Source§impl PcmChunk
impl PcmChunk
Sourcepub fn new(meta: PcmMeta, pcm: PcmBuf) -> Self
pub fn new(meta: PcmMeta, pcm: PcmBuf) -> Self
Create a new PcmChunk from a pool-backed buffer.
Sourcepub fn frames(&self) -> usize
pub fn frames(&self) -> usize
Number of audio frames in this chunk.
A frame contains one sample per channel.
Trait Implementations§
Source§impl Clone for PcmChunk
impl Clone for PcmChunk
Source§fn clone(&self) -> Self
fn clone(&self) -> Self
Clone creates a new pool-backed buffer with copied samples.
Each clone gets its own PcmBuf from the global pool,
so both original and clone recycle independently on drop.
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl TryFrom<DecoderChunkOutcome> for PcmChunk
impl TryFrom<DecoderChunkOutcome> for PcmChunk
Source§type Error = DecoderChunkOutcome
type Error = DecoderChunkOutcome
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for PcmChunk
impl !RefUnwindSafe for PcmChunk
impl Send for PcmChunk
impl Sync for PcmChunk
impl Unpin for PcmChunk
impl UnsafeUnpin for PcmChunk
impl !UnwindSafe for PcmChunk
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more