chiark / gitweb /
update CHANGES.html
[disorder] / server / speaker-alsa.c
index 731c4ff4c3dddd07db298de5bf8fdc51d7cac20c..21a9a75889e0835a312475d030d26b58a06d1b6d 100644 (file)
 /** @file server/speaker-alsa.c
  * @brief Support for @ref BACKEND_ALSA */
 
-#include <config.h>
+#include "common.h"
 
 #if HAVE_ALSA_ASOUNDLIB_H
 
-#include "types.h"
-
 #include <unistd.h>
 #include <poll.h>
 #include <alsa/asoundlib.h>
@@ -51,7 +49,6 @@ static void alsa_init(void) {
 static void log_params(snd_pcm_hw_params_t *hwparams,
                        snd_pcm_sw_params_t *swparams) {
   snd_pcm_uframes_t f;
-  unsigned u;
 
   return;                               /* too verbose */
   if(hwparams) {
@@ -62,14 +59,22 @@ static void log_params(snd_pcm_hw_params_t *hwparams,
     info("sw silence_size=%lu", (unsigned long)f);
     snd_pcm_sw_params_get_silence_threshold(swparams, &f);
     info("sw silence_threshold=%lu", (unsigned long)f);
-    snd_pcm_sw_params_get_sleep_min(swparams, &u);
-    info("sw sleep_min=%lu", (unsigned long)u);
+#if HAVE_SND_PCM_SW_PARAMS_GET_SLEEP_MIN
+    {
+      unsigned u;
+
+      snd_pcm_sw_params_get_sleep_min(swparams, &u);
+      info("sw sleep_min=%lu", (unsigned long)u);
+    }
+#endif
     snd_pcm_sw_params_get_start_threshold(swparams, &f);
     info("sw start_threshold=%lu", (unsigned long)f);
     snd_pcm_sw_params_get_stop_threshold(swparams, &f);
     info("sw stop_threshold=%lu", (unsigned long)f);
+#if HAVE_SND_PCM_SW_PARAMS_GET_XFER_ALIGN
     snd_pcm_sw_params_get_xfer_align(swparams, &f);
     info("sw xfer_align=%lu", (unsigned long)f);
+#endif
   }
 }
 
@@ -219,7 +224,7 @@ static size_t alsa_play(size_t frames) {
 static int alsa_slots, alsa_nslots = -1;
 
 /** @brief Fill in poll fd array for ALSA */
-static void alsa_beforepoll(void) {
+static void alsa_beforepoll(int attribute((unused)) *timeoutp) {
   /* We send sample data to ALSA as fast as it can accept it, relying on
    * the fact that it has a relatively small buffer to minimize pause
    * latency. */