pub struct MmapIO<S, D> { /* private fields */ }
Expand description
Struct containing direct I/O functions shared between playback and capture.
Implementations§
source§impl<S, D: MmapDir> MmapIO<S, D>
impl<S, D: MmapDir> MmapIO<S, D>
sourcepub fn appl_ptr(&self) -> Frames
pub fn appl_ptr(&self) -> Frames
Read current number of frames committed by application
This number wraps at ‘boundary’.
sourcepub fn hw_ptr(&self) -> Frames
pub fn hw_ptr(&self) -> Frames
Read current number of frames read / written by hardware
This number wraps at ‘boundary’.
sourcepub fn buffer_size(&self) -> Frames
pub fn buffer_size(&self) -> Frames
Total number of frames in hardware buffer
sourcepub fn commit(&self, v: Frames)
pub fn commit(&self, v: Frames)
Notifies the kernel that frames have now been read / written by the application
This will allow the kernel to write new data into this part of the buffer.
sourcepub fn avail(&self) -> Frames
pub fn avail(&self) -> Frames
Number of frames available to read / write.
In case of an underrun, this value might be bigger than the buffer size.
sourcepub fn data_ptr(&self) -> (RawSamples<S>, Option<RawSamples<S>>)
pub fn data_ptr(&self) -> (RawSamples<S>, Option<RawSamples<S>>)
Returns raw pointers to data to read / write.
Use this if you want to read/write data yourself (instead of using iterators). If you do,
using write_volatile
or read_volatile
is recommended, since it’s DMA memory and can
change at any time.
Since this is a ring buffer, there might be more data to read/write in the beginning of the buffer as well. If so this is returned as the second return value.