Skip to main content

bytes_to_i16

Function bytes_to_i16 

Source
pub fn bytes_to_i16(data: &[u8]) -> Option<&[i16]>
Expand description

Convert raw bytes to i16 PCM samples (zero-copy via bytemuck).

Returns None if the byte slice length is not a multiple of 2 or the slice is not 2-byte aligned. Both are normal for a slice cut from a network frame, and the cast uses the machine’s byte order; for bytes that arrive off the wire use pcm16_le_samples, which has none of these conditions.