⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Module alsa

Module alsa 

Source
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§

AlsaMixer
ALSA mixer managing multiple controls
CaptureDevice
Audio capture device with ring buffer and overrun detection
CaptureStats
Statistics for a capture device
DeviceInfo
Information about a registered audio device
DeviceRegistry
Registry of available audio devices
GainFactor
Gain scaling factor in 16.16 fixed-point
HwParams
Hardware parameters for a PCM device (analogous to snd_pcm_hw_params)
MixerControl
A mixer control element
PcmDevice
ALSA-compatible PCM device
SwParams
Software parameters for a PCM device (analogous to snd_pcm_sw_params)

Enums§

AlsaError
ALSA subsystem error type
CaptureState
Capture device state
MixerControlType
Type of mixer control
PcmFormat
ALSA-compatible PCM sample format
PcmState
ALSA PCM device state
StreamDirection
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