pub enum Reader<R>{
Flac(FlacReader<R>),
OggVorbis(OggStreamReader<R>),
Wav(WavReader<R>),
CafAlac(AlacReader<R>),
}
Expand description
Returned by the read
function, enumerates the various supported readers.
Variants§
Implementations§
Source§impl Reader<BufReader<File>>
impl Reader<BufReader<File>>
Sourcepub fn open<P>(file_path: P) -> Result<Self, ReadError>
pub fn open<P>(file_path: P) -> Result<Self, ReadError>
Attempts to open an audio Reader
from the file at the specified Path
.
This function is a convenience wrapper around the Reader::new
function.
This function pays no attention to the file_path
’s extension and instead attempts to read
a supported Format
via the file header.
Source§impl<R> Reader<R>
impl<R> Reader<R>
Sourcepub fn new(reader: R) -> Result<Self, ReadError>
pub fn new(reader: R) -> Result<Self, ReadError>
Attempts to read the format of the audio read by the given reader
and returns the associated
Reader
variant.
The format is determined by attempting to construct each specific format reader until one is successful.
Sourcepub fn description(&self) -> Description
pub fn description(&self) -> Description
A basic description of the audio being read.
Sourcepub fn samples<S>(&mut self) -> Samples<'_, R, S> ⓘwhere
S: Sample,
pub fn samples<S>(&mut self) -> Samples<'_, R, S> ⓘwhere
S: Sample,
Produce an iterator that reads samples from the underlying reader, converts them to the
sample type S
if not already in that format and yields them.
When reading from multiple channels, samples are interleaved.
Sourcepub fn frames<F>(&mut self) -> Frames<'_, R, F> ⓘ
pub fn frames<F>(&mut self) -> Frames<'_, R, F> ⓘ
Produce an iterator that yields read frames from the underlying Reader
.
This method currently expects that the frame type F
has the same number of channels as
stored in the underlying audio format.
TODO: Should consider changing this behaviour to check the audio file’s actual number of
channels and automatically convert to F
’s number of channels while reading.