summaryrefslogtreecommitdiff
blob: fdbceb35e1619cb3177be06840e0e4333d4c9e6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
diff -Naur esound-0.2.32.orig/acconfig.h esound-0.2.32/acconfig.h
--- esound-0.2.32.orig/acconfig.h	2003-08-01 09:56:21.000000000 -0400
+++ esound-0.2.32/acconfig.h	2004-02-02 08:53:54.000000000 -0500
@@ -8,6 +8,7 @@
 #undef DRIVER_ALSA
 #undef DRIVER_NEWALSA
 #undef DRIVER_ALSA_09
+#undef DRIVER_ALSA_09_AFTER_RC4
 #undef DRIVER_DART
 #undef DRIVER_COREAUDIO
 #undef DRIVER_NONE
diff -Naur esound-0.2.32.orig/audio_alsa09.c esound-0.2.32/audio_alsa09.c
--- esound-0.2.32.orig/audio_alsa09.c	2003-03-20 03:34:19.000000000 -0500
+++ esound-0.2.32/audio_alsa09.c	2004-02-02 08:58:18.000000000 -0500
@@ -94,7 +94,11 @@
 	snd_pcm_hw_params_t *hwparams;
 	int err;
 	int periods;
-  
+#ifdef DRIVER_ALSA_09_AFTER_RC4
+	int t_dir, t_speed;
+	snd_pcm_uframes_t t_bufsize;
+#endif
+
 	err = snd_pcm_open(&handle, dev, mode, SND_PCM_NONBLOCK);
 	if (err < 0) {
 		if (alsadbg)
@@ -136,15 +140,24 @@
 		alsaerr = -1;
 		return handle;
 	}
-  
+#ifndef DRIVER_ALSA_09_AFTER_RC4
 	err = snd_pcm_hw_params_set_rate_near(handle, hwparams, speed, 0);
+#else
+	t_dir=0;
+	t_speed=speed;
+	err = snd_pcm_hw_params_set_rate_near(handle, hwparams, &t_speed, &t_dir);
+#endif
 	if (err < 0) {
 		if (alsadbg)
 			fprintf(stderr, "%s\n", snd_strerror(err));
 		alsaerr = -1;
 		return handle;
 	}
+#ifndef DRIVER_ALSA_09_AFTER_RC4
 	if (err != speed) {
+#else
+	if (t_speed != speed) {
+#endif
 		if (alsadbg)
 			fprintf(stderr, "Rate not avaliable %i != %i\n", speed, err);
 		alsaerr = -1;
@@ -176,8 +189,12 @@
 		alsaerr = -1;
 		return handle;
 	}
-  
+#ifndef DRIVER_ALSA_09_AFTER_RC4
 	err = snd_pcm_hw_params_set_buffer_size_near(handle, hwparams, BUFFERSIZE); 
+#else
+	t_bufsize=BUFFERSIZE;
+	err = snd_pcm_hw_params_set_buffer_size_near(handle, hwparams, &t_bufsize);
+#endif
 	if (err < 0) { 
 		if (alsadbg)
 			fprintf(stderr, "Buffersize:%s\n", snd_strerror(err)); 
diff -Naur esound-0.2.32.orig/configure.in esound-0.2.32/configure.in
--- esound-0.2.32.orig/configure.in	2003-09-03 12:23:23.000000000 -0400
+++ esound-0.2.32/configure.in	2004-02-02 08:53:54.000000000 -0500
@@ -269,6 +269,22 @@
       AC_CHECK_FUNC(snd_cards,,[AC_CHECK_LIB(sound,snd_cards)])
       AC_CHECK_FUNC(snd_cards,,[AC_CHECK_LIB(asound,snd_cards)])
       AC_CHECK_FUNC(snd_pcm_pause,,[AC_CHECK_LIB(asound,snd_pcm_pause)])
+
+      dnl Check if ALSA uses new API
+      CFLAGS="${CFLAGS} -Werror"
+      AC_TRY_LINK([
+	  #include <alsa/asoundlib.h>
+	  ], [
+	  snd_pcm_t *pcm;
+	  snd_pcm_hw_params_t *params;
+	  unsigned int val;
+	  int dir;
+	  /* intentionally uses non-pointers, trying to replicate bug 129709 */
+	  snd_pcm_hw_params_set_rate_near(pcm, params, val, dir);
+	  ], , [
+	  AC_DEFINE(DRIVER_ALSA_09_AFTER_RC4)
+	  ])
+
    fi
 else
    AC_DEFINE(DRIVER_NONE)