[][src]Struct alsa::direct::pcm::Status

pub struct Status(_);

Read PCM status directly from memory, bypassing alsa-lib.

This means that it's

  1. less overhead for reading status (no syscall, no allocations, no virtual dispatch, just a read from memory)
  2. Send + Sync, and
  3. will only work for "hw" / "plughw" devices (not e g PulseAudio plugins), and not all of those are supported, although all common ones are (as of 2017, and a kernel from the same decade). Kernel supported archs are: x86, PowerPC, Alpha. Use "SyncPtrStatus" for other archs.

The values are updated every now and then by the kernel. Many functions will force an update to happen, e g PCM::avail() and PCM::delay().

Note: Even if you close the original PCM device, ALSA will not actually close the device until all Status structs are dropped too.

Methods

impl Status[src]

pub fn new(p: &PCM) -> Result<Self>[src]

pub fn from_fd(fd: RawFd) -> Result<Self>[src]

pub fn state(&self) -> State[src]

Current PCM state.

pub fn hw_ptr(&self) -> Frames[src]

Number of frames hardware has read or written

This number is updated every now and then by the kernel. Calling most functions on the PCM will update it, so will usually a period interrupt. No guarantees given.

This value wraps at "boundary" (a large value you can read from SwParams).

pub fn htstamp(&self) -> timespec[src]

Timestamp - fast version of alsa-lib's Status::get_htstamp

Note: This just reads the actual value in memory. Unfortunately, the timespec is too big to be read atomically on most archs. Therefore, this function can potentially give bogus result at times, at least in theory...?

pub fn audio_htstamp(&self) -> timespec[src]

Audio timestamp - fast version of alsa-lib's Status::get_audio_htstamp

Note: This just reads the actual value in memory. Unfortunately, the timespec is too big to be read atomically on most archs. Therefore, this function can potentially give bogus result at times, at least in theory...?

Trait Implementations

impl Debug for Status[src]

Auto Trait Implementations

impl Send for Status

impl Sync for Status

Blanket Implementations

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

impl<T, U> Into<U> for T where
    U: From<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> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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