commit 8b3efdb322551aaf432334c16a23f52789c22989 from: Omar Polo date: Fri May 12 22:31:07 2023 UTC alsa: set up the onmove callback With this the alsa backend reports the progresses too, forgot previously. commit - 440c29a48baee8e864752653f5cca6ea842cfd1e commit + 8b3efdb322551aaf432334c16a23f52789c22989 blob - 768c7c7b80ed2fcbb6b05e4bcc63d5fd23729c73 blob + 07f43795676ea21645ad6ae56597c54673a035e1 --- audio_alsa.c +++ audio_alsa.c @@ -25,9 +25,10 @@ static snd_pcm_t *pcm; static size_t bpf; +static void (*onmove_cb)(void *, int); int -audio_open(void (*onmove_cb)(void *, int)) +audio_open(void (*cb)(void *, int)) { const char *device = "default"; int err; @@ -39,7 +40,7 @@ audio_open(void (*onmove_cb)(void *, int)) return -1; } - /* TODO: set up onmove callback? */ + onmove_cb = cb; return 0; } @@ -143,6 +144,8 @@ audio_write(const void *buf, size_t len) log_warnx("snd_pcm_writei failed: %s", snd_strerror(ret)); return 0; } + if (onmove_cb) + onmove_cb(NULL, ret); return ret * bpf; }