[][src]Struct alsa::pcm::IO

pub struct IO<'a, S: Copy>(_, _);

Sample format dependent struct for reading from and writing data to a PCM. Also implements std::io::Read and std::io::Write.

Note: Only one IO object is allowed in scope at a time (for mmap safety).

Methods

impl<'a, S: Copy> IO<'a, S>[src]

pub fn writei(&self, buf: &[S]) -> Result<usize>[src]

On success, returns number of frames written. (Multiply with number of channels to get number of items in buf successfully written.)

pub fn readi(&self, buf: &mut [S]) -> Result<usize>[src]

On success, returns number of frames read. (Multiply with number of channels to get number of items in buf successfully read.)

pub fn mmap<F: FnOnce(&mut [S]) -> usize>(
    &self,
    frames: usize,
    func: F
) -> Result<usize>
[src]

Wrapper around snd_pcm_mmap_begin and snd_pcm_mmap_commit.

You can read/write into the sound card's buffer during the call to the closure. According to alsa-lib docs, you should call avail_update before calling this function.

All calculations are in frames, i e, the closure should return number of frames processed. Also, there might not be as many frames to read/write as requested, and there can even be an empty buffer supplied to the closure.

Note: This function works only with interleaved access mode.

Trait Implementations

impl<'a, S: Copy> Drop for IO<'a, S>[src]

impl<'a, S: Copy> Read for IO<'a, S>[src]

impl<'a, S: Copy> Write for IO<'a, S>[src]

Auto Trait Implementations

impl<'a, S> !Send for IO<'a, S>

impl<'a, S> !Sync for IO<'a, S>

impl<'a, S> Unpin for IO<'a, S> where
    S: Unpin

impl<'a, S> !UnwindSafe for IO<'a, S>

impl<'a, S> !RefUnwindSafe for IO<'a, S>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]