Crates.io | alsa |
lib.rs | alsa |
version | 0.9.1 |
source | src |
created_at | 2015-06-08 16:34:25.33632 |
updated_at | 2024-08-21 05:55:30.198262 |
description | Thin but safe wrappers for ALSA (Linux sound API) |
homepage | |
repository | https://github.com/diwic/alsa-rs |
max_upload_size | |
id | 2341 |
size | 442,440 |
Thin but safe wrappers for ALSA, the most common API for accessing audio devices on Linux.
The ALSA API is rather big, so everything is not covered yet, but expect the following to work:
Audio Playback (example in pcm
module docs)
Audio Recording
Mixer controls
HCtl API (jack detection example in hctl
module docs)
Raw midi
Midi sequencer (most of it)
Ctl API
Device name hints (example in device_name
module docs)
Enumerations of all of the above
Poll and/or wait for all of the above
The following is not yet implemented (mostly because nobody asked for them) :
Separate timer API (snd_timer_*)
Config API (snd_config_*)
Plug-in API
Quickstart guide / API design:
Most functions map 1-to-1 to alsa-lib functions, e g, ctl::CardInfo::get_id()
is a wrapper around
snd_ctl_card_info_get_id
and the alsa-lib documentation
can be consulted for additional information.
Structs are RAII and closed/freed on drop, e g, when a PCM
struct is dropped, snd_pcm_close
is called.
To read and write buffers, call the io_*
methods. It will return a separate struct from which you can
read or write, and which can also be used for mmap (if supported by the driver).
Error handling - most alsa-lib functions can return errors, so the return value from these is a Result
.
Enumeration of cards, devices etc is done through structs implementing Iterator
.
Many structs implement poll::Descriptors
, to combine with your favorite async framework.
Or just use wait
if you don't need non-blocking functionality.
Notes: