Struct alsa::pcm::PCM

source ·
pub struct PCM(_, _);
Expand description

snd_pcm_t wrapper - start here for audio playback and recording

Implementations§

source§

impl PCM

source

pub fn new(name: &str, dir: Direction, nonblock: bool) -> Result<PCM>

Wrapper around open that takes a &str instead of a &CStr

source

pub fn open(name: &CStr, dir: Direction, nonblock: bool) -> Result<PCM>

source

pub fn start(&self) -> Result<()>

source

pub fn drop(&self) -> Result<()>

source

pub fn pause(&self, pause: bool) -> Result<()>

source

pub fn resume(&self) -> Result<()>

source

pub fn drain(&self) -> Result<()>

source

pub fn prepare(&self) -> Result<()>

source

pub fn reset(&self) -> Result<()>

source

pub fn recover(&self, err: c_int, silent: bool) -> Result<()>

source

pub fn try_recover(&self, err: Error, silent: bool) -> Result<()>

Wrapper around snd_pcm_recover.

Returns Ok if the error was successfully recovered from, or the original error if the error was unhandled.

source

pub fn wait(&self, timeout_ms: Option<u32>) -> Result<bool>

source

pub fn state(&self) -> State

source

pub fn state_raw(&self) -> c_int

Only used internally, and for debugging the alsa library. Please use the “state” function instead.

source

pub fn bytes_to_frames(&self, i: isize) -> Frames

source

pub fn frames_to_bytes(&self, i: Frames) -> isize

source

pub fn avail_update(&self) -> Result<Frames>

source

pub fn avail(&self) -> Result<Frames>

source

pub fn avail_delay(&self) -> Result<(Frames, Frames)>

source

pub fn delay(&self) -> Result<Frames>

source

pub fn status(&self) -> Result<Status>

source

pub fn io_i8(&self) -> Result<IO<'_, i8>>

source

pub fn io_u8(&self) -> Result<IO<'_, u8>>

source

pub fn io_i16(&self) -> Result<IO<'_, i16>>

source

pub fn io_u16(&self) -> Result<IO<'_, u16>>

source

pub fn io_i32(&self) -> Result<IO<'_, i32>>

source

pub fn io_u32(&self) -> Result<IO<'_, u32>>

source

pub fn io_f32(&self) -> Result<IO<'_, f32>>

source

pub fn io_f64(&self) -> Result<IO<'_, f64>>

source

pub fn io_checked<S: IoFormat>(&self) -> Result<IO<'_, S>>

source

pub fn io(&self) -> IO<'_, u8>

👎Deprecated: renamed to io_bytes
source

pub fn io_bytes(&self) -> IO<'_, u8>

source

pub fn direct_mmap_capture<S>(&self) -> Result<MmapCapture<S>>

Read buffers by talking to the kernel directly, bypassing alsa-lib.

source

pub fn direct_mmap_playback<S>(&self) -> Result<MmapPlayback<S>>

Write buffers by talking to the kernel directly, bypassing alsa-lib.

source

pub fn hw_params(&self, h: &HwParams<'_>) -> Result<()>

Sets hw parameters. Note: No IO object can exist for this PCM when hw parameters are set.

source

pub fn hw_params_current(&self) -> Result<HwParams<'_>>

Retreive current PCM hardware configuration.

source

pub fn sw_params(&self, h: &SwParams<'_>) -> Result<()>

source

pub fn sw_params_current(&self) -> Result<SwParams<'_>>

source

pub fn get_params(&self) -> Result<(u64, u64)>

Wraps snd_pcm_get_params, returns (buffer_size, period_size).

source

pub fn info(&self) -> Result<Info>

source

pub fn dump(&self, o: &mut Output) -> Result<()>

source

pub fn dump_hw_setup(&self, o: &mut Output) -> Result<()>

source

pub fn dump_sw_setup(&self, o: &mut Output) -> Result<()>

source

pub fn query_chmaps(&self) -> ChmapsQuery

source

pub fn set_chmap(&self, c: &Chmap) -> Result<()>

source

pub fn get_chmap(&self) -> Result<Chmap>

Trait Implementations§

source§

impl Descriptors for PCM

source§

fn count(&self) -> usize

source§

fn fill(&self, p: &mut [pollfd]) -> Result<usize>

source§

fn revents(&self, p: &[pollfd]) -> Result<Flags>

source§

fn get(&self) -> Result<Vec<pollfd>>

Wrapper around count and fill - returns an array of pollfds
source§

impl Drop for PCM

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Send for PCM

Auto Trait Implementations§

§

impl !RefUnwindSafe for PCM

§

impl !Sync for PCM

§

impl Unpin for PCM

§

impl UnwindSafe for PCM

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.