[−][src]Struct dsf::Frames
Representation of the frames of an associated DsfFile.
A frame consists of n blocks, one for each channel. So a stereo frame consits of two blocks, the first contains 4096 bytes of sample data for the front-left channel, the second contains 4096 bytes of data for the front-right channel.
Only one frame ever exists in memory at a time. When a new frame is required it is loaded from file on-demand. This keeps the memory footprint small e.g. 2 × 4096 = 8192 bytes for a stereo frame.
Methods
impl<'a> Frames<'a>
[src]
pub fn offset(&self, frame_index: u64) -> Result<u64, Error>
[src]
Return the offset (position in the DSF file in bytes) of the specified frame.
Note that frame_index
is zero-based so the first frame has
frame_index=0
, etc. Thie method returns an error if
frame_index >= frame_count
.
pub fn frame_and_block_index(
&self,
sample_index: u64
) -> Result<(u64, usize), Error>
[src]
&self,
sample_index: u64
) -> Result<(u64, usize), Error>
Return the frame and block index as a tuple (frame_index, block_index)
for the given sample_index
if they exist or a
out of range error if sample_index >= sample_count
.
pub fn load_frame(&mut self, frame_index: u64) -> Result<(), Error>
[src]
Load the frame specified by frame_index
into memory.
The Frames
struct keeps only one frame in memory at a
time. This method returns an error if frames_index
is out of
range or there is an io::Error
.
pub fn samples_as_u32(
&mut self,
channel_index: usize,
sample_index: u64
) -> Result<u32, Error>
[src]
&mut self,
channel_index: usize,
sample_index: u64
) -> Result<u32, Error>
Return a u32
containing the specified sample and channel.
Auto Trait Implementations
impl<'a> RefUnwindSafe for Frames<'a>
impl<'a> Send for Frames<'a>
impl<'a> Sync for Frames<'a>
impl<'a> Unpin for Frames<'a>
impl<'a> !UnwindSafe for Frames<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,