|0.4.2||Apr 30, 2020|
|0.4.1||Jan 10, 2020|
|0.4.0||Oct 28, 2019|
|0.3.0||Jul 18, 2019|
|0.0.5||Jun 21, 2015|
#22 in Audio
6,856 downloads per month
Used in 22 crates (10 directly)
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
HCtl API (jack detection example in
Midi sequencer (most of it)
Device name hints (example in
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_*)
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_idand the alsa-lib documentation can be consulted for additional information.
Structs are RAII and closed/freed on drop, e g, when a
PCMstruct is dropped,
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
Enumeration of cards, devices etc is done through structs implementing
Many structs implement
poll::Descriptors, to combine with poll or mio. Or just use
waitif you don't need non-blocking functionality.