pub type MmapCapture<S> = MmapIO<S, Capture>;
Aliased Type§
struct MmapCapture<S> { /* private fields */ }
Implementations§
Source§impl<S> MmapCapture<S>
impl<S> MmapCapture<S>
Sourcepub fn iter(&mut self) -> CaptureIter<'_, S> ⓘ
pub fn iter(&mut self) -> CaptureIter<'_, S> ⓘ
Read samples from the kernel ringbuffer.
When the iterator is dropped or depleted, the read samples will be committed, i e, the kernel can then write data to the location again. So do this ASAP.
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.