alsa::direct::pcm

Type Alias MmapPlayback

Source
pub type MmapPlayback<S> = MmapIO<S, Playback>;

Aliased Type§

struct MmapPlayback<S> { /* private fields */ }

Implementations§

Source§

impl<S> MmapPlayback<S>

Source

pub fn write<I: Iterator<Item = S>>(&mut self, i: &mut I) -> Frames

Write samples to the kernel ringbuffer.

Source§

impl<S, D: MmapDir> MmapIO<S, D>

Source

pub fn status(&self) -> &Status

Read current status

Source

pub fn appl_ptr(&self) -> Frames

Read current number of frames committed by application

This number wraps at ‘boundary’.

Source

pub fn hw_ptr(&self) -> Frames

Read current number of frames read / written by hardware

This number wraps at ‘boundary’.

Source

pub fn boundary(&self) -> Frames

The number at which hw_ptr and appl_ptr wraps.

Source

pub fn buffer_size(&self) -> Frames

Total number of frames in hardware buffer

Source

pub fn channels(&self) -> u32

Number of channels in stream

Source

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.

Source

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.

Source

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.

Trait Implementations

Source§

impl<S: Debug, D: Debug> Debug for MmapIO<S, D>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more