Expand description
ALSA-Compatible Audio API and Capture Pipeline
Provides PCM device management, mixer controls, and audio recording/capture compatible with the ALSA programming model. All arithmetic uses integer or 16.16 fixed-point math – no floating point.
§Key Components
- PCM Device: Open/close/read/write with hardware and software parameters
- State Machine: Open -> Setup -> Prepared -> Running -> XRun/Draining/Paused
- Mixer Controls: Master, PCM, and Capture volume with integer 0-100 range
- Capture Pipeline: Hardware -> ring buffer -> client read with overrun detection
- Device Registry: Enumerate playback and capture devices
- Sample Conversion: Between U8, S16, and S32 formats
- Gain Control: Integer dB scaling via 16.16 fixed-point multiplication
Structs§
- Alsa
Mixer - ALSA mixer managing multiple controls
- Capture
Device - Audio capture device with ring buffer and overrun detection
- Capture
Stats - Statistics for a capture device
- Device
Info - Information about a registered audio device
- Device
Registry - Registry of available audio devices
- Gain
Factor - Gain scaling factor in 16.16 fixed-point
- HwParams
- Hardware parameters for a PCM device (analogous to snd_pcm_hw_params)
- Mixer
Control - A mixer control element
- PcmDevice
- ALSA-compatible PCM device
- SwParams
- Software parameters for a PCM device (analogous to snd_pcm_sw_params)
Enums§
- Alsa
Error - ALSA subsystem error type
- Capture
State - Capture device state
- Mixer
Control Type - Type of mixer control
- PcmFormat
- ALSA-compatible PCM sample format
- PcmState
- ALSA PCM device state
- Stream
Direction - PCM stream direction
Constants§
- MIXER_
CAPTURE_ SWITCH - Capture mute switch control ID
- MIXER_
CAPTURE_ VOLUME - Capture volume control ID
- MIXER_
MASTER_ SWITCH - Master mute switch control ID
- MIXER_
MASTER_ VOLUME - Well-known mixer control IDs
- MIXER_
PCM_ VOLUME - PCM playback volume control ID
Functions§
- init
- Initialize the ALSA subsystem
- with_
alsa_ mixer - Access the ALSA mixer through a closure
- with_
alsa_ mixer_ mut - Access the ALSA mixer mutably through a closure
- with_
registry - Access the device registry through a closure
- with_
registry_ mut - Access the device registry mutably through a closure