chiark / gitweb /
Use snd_pcm_prepare() instead of snd_pcm_recover(), since the latter
authorRichard Kettlewell <richard@dekabrach>
Tue, 25 Mar 2008 19:41:52 +0000 (19:41 +0000)
committerRichard Kettlewell <richard@dekabrach>
Tue, 25 Mar 2008 19:41:52 +0000 (19:41 +0000)
isn't available in older ALSAs.

lib/alsabg.c
lib/alsabg.h

index 61648f4..be589ce 100644 (file)
@@ -179,12 +179,14 @@ static void *alsa_bg_play(void attribute((unused)) *arg) {
     rframes = snd_pcm_writei(pcm, alsa_bg_buffer + start, nframes);
     ep(pthread_mutex_lock(&alsa_bg_lock));
     if(rframes < 0) {
-      error(0, "snd_pcm_writei: %d", rframes);
       switch(rframes) {
       case -EPIPE:
-        if((err = snd_pcm_recover(pcm, -EPIPE, 0)))
-          fatal(0, "snd_pcm_recover: %d", err);
+        error(0, "underrun detected");
+        if((err = snd_pcm_prepare(pcm)))
+          fatal(0, "snd_pcm_prepare: %d", err);
         break;
+      default:
+        fatal(0, "snd_pcm_writei: %d", rframes);
       }
     } else {
       const int rbytes = rframes * BYTES_PER_FRAME;
index 0ef9c59..57fb64d 100644 (file)
@@ -37,9 +37,9 @@
  * occurred.  It will be called in a background thread.
  */
 typedef int alsa_bg_supply(void *dst,
-                          unsigned nsamples);
+                          unsigned nsamples_max);
 
-void alsa_bg_init(const char *device,
+void alsa_bg_init(const char *dev,
                  alsa_bg_supply *supply);
 
 void alsa_bg_enable(void);