pub struct DsfFile { /* private fields */ }
Expand description
In memory representation of a DSF file.
The DSF File Format Specification divides a DSF file into four chunks:
- DSD chunk: basic file headers, size and pointers to other chunks.
- Fmt chunk: information about the audio format e.g. sampling rate, etc.
- Data chunk: the audio samples.
- Metadata chunk: an optional
ID3v2
metadata tag.
The fields of the DsfFile
struct reflect this specification,
with an additional File field for the underlying file.
Implementations§
Source§impl DsfFile
impl DsfFile
Sourcepub fn open(path: &Path) -> Result<DsfFile, Error>
pub fn open(path: &Path) -> Result<DsfFile, Error>
Attempt to open and parse the metadata of DSF file in read-only mode. Sample data is not read into memory to keep the memory footprint small.
§Errors
This function will return an error if path
does not exist or
is not a readable and valid DSF file.
§Examples
use dsf::DsfFile;
use std::path::Path;
let path = Path::new("my/music.dsf");
match DsfFile::open(path) {
Ok(dsf_file) => {
println!("DSF file metadata:\n\n{}", dsf_file);
}
Err(error) => {
println!("Error: {}", error);
}
}
Sourcepub fn data_chunk(&self) -> &DataChunk
pub fn data_chunk(&self) -> &DataChunk
Return a reference to the DataChunk
.
Sourcepub fn interleaved_u32_samples_iter(
&mut self,
) -> Result<InterleavedU32SamplesIter<'_>, Error>
pub fn interleaved_u32_samples_iter( &mut self, ) -> Result<InterleavedU32SamplesIter<'_>, Error>
Return an
InterleavedU32SamplesIter
for the sample data contained in this DSF file.
§Errors
This function will return an error if the sample data is not readable.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DsfFile
impl RefUnwindSafe for DsfFile
impl Send for DsfFile
impl Sync for DsfFile
impl Unpin for DsfFile
impl UnwindSafe for DsfFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more