Commit Briefs

Omar Polo

cache audio_nfds()

ALSA' snd_pcm_poll_descriptors_count() can fail with -EPIPE after an underrun (e.g. after a pause), so we can't call it directly like this. It's also a bit sloppy to always call audio_nfds(), so instead save the (initial) value returned and pass it to the various functions. Issue reported and fix tested by phoebos (ben [at] bvnf [dot] space), thank you!


Omar Polo

alsa: set up the onmove callback

With this the alsa backend reports the progresses too, forgot previously.


Omar Polo

alsa: handle xrun due to pausing

amused implements pausing as not sending audio at all until resuming, i.e. by doing an underrun. ALSA is more strict than sndio, by default at least, and so we need to call snd_pcm_recover() before we can play again.


Omar Polo

alsa: fix snd_pcm_writei usage

snd_pcm_writei works in terms of audio frames, not buffer (bytes) length like snd_write does, so account for that. To do so, prepare a `bpf' (bytes per frame) multiplier in the configure stage and use it to convert back and forward between the buffer length and the number of frames. While here, also use snd_pcm_avail_update() to know how many frames may be written.


Omar Polo

add an audio implementation for ALSA

it still doesn't work correctly, audio is very distorted, but at least there's some sound.