pub struct PCM(/* private fields */);
Expand description
snd_pcm_t wrapper - start here for audio playback and recording
Implementations§
Source§impl PCM
impl PCM
Sourcepub fn new(name: &str, dir: Direction, nonblock: bool) -> Result<PCM>
pub fn new(name: &str, dir: Direction, nonblock: bool) -> Result<PCM>
Wrapper around open that takes a &str instead of a &CStr
pub fn open(name: &CStr, dir: Direction, nonblock: bool) -> Result<PCM>
pub fn start(&self) -> Result<()>
pub fn drop(&self) -> Result<()>
pub fn pause(&self, pause: bool) -> Result<()>
pub fn resume(&self) -> Result<()>
pub fn drain(&self) -> Result<()>
pub fn prepare(&self) -> Result<()>
pub fn reset(&self) -> Result<()>
pub fn recover(&self, err: c_int, silent: bool) -> Result<()>
Sourcepub fn try_recover(&self, err: Error, silent: bool) -> Result<()>
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.
pub fn wait(&self, timeout_ms: Option<u32>) -> Result<bool>
pub fn state(&self) -> State
Sourcepub fn state_raw(&self) -> c_int
pub fn state_raw(&self) -> c_int
Only used internally, and for debugging the alsa library. Please use the “state” function instead.
pub fn bytes_to_frames(&self, i: isize) -> Frames
pub fn frames_to_bytes(&self, i: Frames) -> isize
pub fn avail_update(&self) -> Result<Frames>
pub fn avail(&self) -> Result<Frames>
pub fn avail_delay(&self) -> Result<(Frames, Frames)>
pub fn delay(&self) -> Result<Frames>
pub fn status(&self) -> Result<Status>
pub fn io_i8(&self) -> Result<IO<'_, i8>>
pub fn io_u8(&self) -> Result<IO<'_, u8>>
pub fn io_i16(&self) -> Result<IO<'_, i16>>
pub fn io_u16(&self) -> Result<IO<'_, u16>>
pub fn io_i32(&self) -> Result<IO<'_, i32>>
pub fn io_u32(&self) -> Result<IO<'_, u32>>
pub fn io_f32(&self) -> Result<IO<'_, f32>>
pub fn io_f64(&self) -> Result<IO<'_, f64>>
pub fn io_checked<S: IoFormat>(&self) -> Result<IO<'_, S>>
Sourcepub unsafe fn io_unchecked<S: IoFormat>(&self) -> IO<'_, S> ⓘ
pub unsafe fn io_unchecked<S: IoFormat>(&self) -> IO<'_, S> ⓘ
Creates IO without checking [S
] is valid type.
SAFETY: Caller must guarantee [S
] is valid type for this PCM stream
and that no other IO objects exist at the same time for the same stream
(or in some other way guarantee mmap safety)
pub fn io(&self) -> IO<'_, u8> ⓘ
pub fn io_bytes(&self) -> IO<'_, u8> ⓘ
Sourcepub fn direct_mmap_capture<S>(&self) -> Result<MmapCapture<S>>
pub fn direct_mmap_capture<S>(&self) -> Result<MmapCapture<S>>
Read buffers by talking to the kernel directly, bypassing alsa-lib.
Sourcepub fn direct_mmap_playback<S>(&self) -> Result<MmapPlayback<S>>
pub fn direct_mmap_playback<S>(&self) -> Result<MmapPlayback<S>>
Write buffers by talking to the kernel directly, bypassing alsa-lib.
Sourcepub fn hw_params(&self, h: &HwParams<'_>) -> Result<()>
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.
Sourcepub fn hw_params_current(&self) -> Result<HwParams<'_>>
pub fn hw_params_current(&self) -> Result<HwParams<'_>>
Retreive current PCM hardware configuration.
pub fn sw_params(&self, h: &SwParams<'_>) -> Result<()>
pub fn sw_params_current(&self) -> Result<SwParams<'_>>
Sourcepub fn get_params(&self) -> Result<(u64, u64)>
pub fn get_params(&self) -> Result<(u64, u64)>
Wraps snd_pcm_get_params
, returns (buffer_size, period_size)
.