Trait jumpy::prelude::kira::sound::streaming::Decoder

pub trait Decoder: Send {
    type Error;

    // Required methods
    fn sample_rate(&self) -> u32;
    fn num_frames(&self) -> usize;
    fn decode(&mut self) -> Result<Vec<Frame>, Self::Error>;
    fn seek(&mut self, index: usize) -> Result<usize, Self::Error>;
}
Expand description

Decodes chunks of audio.

Required Associated Types§

type Error

Errors that can occur when decoding audio.

Required Methods§

fn sample_rate(&self) -> u32

Returns the sample rate of the audio (in Hz).

fn num_frames(&self) -> usize

Returns the total number of samples of audio.

fn decode(&mut self) -> Result<Vec<Frame>, Self::Error>

Decodes the next chunk of audio.

fn seek(&mut self, index: usize) -> Result<usize, Self::Error>

Seeks to an audio sample.

The index is the requested sample to seek to. It’s OK if the decoder seeks to an earlier sample than the one requested.

This should return the sample index that was actually seeked to.

Implementors§