Skip to main content

pcm16_le_samples

Function pcm16_le_samples 

Source
pub fn pcm16_le_samples(data: &[u8]) -> impl ExactSizeIterator<Item = i16> + '_
Expand description

Decode little-endian PCM16 bytes (the Live wire format) to samples.

Works on any slice: alignment does not matter, the byte order is always little-endian, and a trailing odd byte is ignored.

assert_eq!(pcm16_le_samples(&[1, 0, 0xff, 0xff, 9]).collect::<Vec<_>>(), [1, -1]);