module/alsa: handle ALSA device disappearing

With this patch, a non-existing ALSA device is no longer considered a
fatal error. Instead, we keep retrying until we succeed.

Furthermore, if we have successfully opened the ALSA device, and it
then disappears, we a) no longer crash, or cause 100% CPU usage, and
b) try to re-connect to the device.

With this, we now handle e.g. USB soundcards being disconnected and
then re-connected. We should also handle pseudo devices, like pipewire
provides ones, when yambar is started before pipewire.

Closes #59
Closes #61
Closes #86
This commit is contained in:
Daniel Eklöf 2021-08-18 20:21:04 +02:00
parent 8b6b82f1e5
commit be6e714eb0
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 126 additions and 12 deletions

View file

@ -8,6 +8,9 @@ alsa - Monitors an alsa soundcard for volume and mute/unmute changes
[[ *Name*
:[ *Type*
:[ *Description*
| online
: bool
: True when the ALSA device has successfully been opened
| volume
: range
: Volume level, with min and max as start and end range values