pub struct Decoder<R> { /* private fields */ }Expand description
Streaming AHX decoder with fixed synthesis and PCM arrays, available with std.
No allocation or seeking is performed by this decoder. Wrap files in
std::io::BufReader for efficient small reads. Reader-owned buffering and
output handling are outside the decoder’s allocation guarantee.
Implementations§
Source§impl<R> Decoder<R>
impl<R> Decoder<R>
Sourcepub const fn state(&self) -> DecoderState
pub const fn state(&self) -> DecoderState
Current decoding progress, successful completion, or terminal failure.
Sourcepub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Recover the reader at its current position, without rewinding.
Source§impl<R: Read> Decoder<R>
impl<R: Read> Decoder<R>
Sourcepub fn new(reader: R) -> Result<Self, Error>
pub fn new(reader: R) -> Result<Self, Error>
Validate the header and initialize fixed-size storage without allocating.
Sourcepub fn next_block(&mut self) -> Result<Option<&[i16]>, Error>
pub fn next_block(&mut self) -> Result<Option<&[i16]>, Error>
Decode up to SAMPLES_PER_FRAME mono PCM16 elements into borrowed storage.
No startup samples are discarded and no resampling occurs. The final block
is trimmed to the declared duration after validating the footer. Errors
invalidate the reader; calls after an error return Error::Failed.
An unwinding panic in caller I/O also leaves it failed.
Calls after successful EOF return None without reading further input.