pub struct PcmBlock<'a> {
pub format: PcmFormat,
pub timestamp: Micros,
pub data: &'a [u8],
}Expand description
A borrowed block of interleaved PCM.
Fields§
§format: PcmFormatRate, channels, encoding.
timestamp: MicrosCapture instant of the first frame on the device’s monotonic clock.
data: &'a [u8]Interleaved sample bytes; a whole number of frames.
Implementations§
Source§impl<'a> PcmBlock<'a>
impl<'a> PcmBlock<'a>
Sourcepub fn new(
format: PcmFormat,
timestamp: Micros,
data: &'a [u8],
) -> Result<PcmBlock<'a>, Error>
pub fn new( format: PcmFormat, timestamp: Micros, data: &'a [u8], ) -> Result<PcmBlock<'a>, Error>
A block over data, which must be non-empty and frame-aligned.
Sourcepub fn duration_micros(&self) -> u64
pub fn duration_micros(&self) -> u64
Duration of this block in microseconds.
Sourcepub fn samples_i16(&self) -> Option<impl Iterator<Item = i16> + 'a>
pub fn samples_i16(&self) -> Option<impl Iterator<Item = i16> + 'a>
Iterate the samples of an SampleFormat::I16 block, interleaved.
Returns None for any other encoding.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for PcmBlock<'a>
impl<'a> RefUnwindSafe for PcmBlock<'a>
impl<'a> Send for PcmBlock<'a>
impl<'a> Sync for PcmBlock<'a>
impl<'a> Unpin for PcmBlock<'a>
impl<'a> UnsafeUnpin for PcmBlock<'a>
impl<'a> UnwindSafe for PcmBlock<'a>
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