shithub: sox

Download patch

ref: 696d929cd731857d95a37929927bc045231762de
parent: c1ac6fab84630212cdc0bc0f9bf84c11b1df82a1
author: cbagwell <cbagwell>
date: Tue Jan 2 10:56:33 EST 2001

Adding support for detecting ALSA 0.4.x and 0.5.x API.

--- a/configure.in
+++ b/configure.in
@@ -133,7 +133,18 @@
 
 if test "$alsa_dsp" = yes
 then
+	AC_MSG_CHECKING([for ALSA ioctl API])
+	AC_TRY_COMPILE(
+[
+#include <linux/asound.h>
+],
+[
+snd_pcm_capture_info_t c_info;
+],
+		alsa_api_ver=oldapi,alsa_api_ver=newapi)
+	AC_MSG_RESULT($alsa_api_ver)
 	CFLAGS="$CFLAGS -DALSA_PLAYER"
+	if test "$alsa_api_ver" = oldapi; then CFLAGS="$CFLAGS -DUSE_OLD_API"; fi
 	NEED_ALSA=1
 	PLAY_SUPPORT=1
 fi
--- a/src/alsa.c
+++ b/src/alsa.c
@@ -21,7 +21,7 @@
 
 static int get_format(P3(ft_t ft, int formats, int *fmt));
 
-#if 0 /* Start old API */
+#ifdef USE_OLD_API /* Start 0.4.x API */
 
 /*
  * Do anything required before you start reading samples.
@@ -128,7 +128,7 @@
     return(ST_SUCCESS);
 }
 
-#else /* Start new API */
+#else /* Start 0.5.x API */
 
 int st_alsastartread(ft)
 ft_t ft;