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
|
$NetBSD: patch-ac,v 1.3 2004/03/29 08:08:13 adam Exp $
--- examples/sndfile-play.c.orig 2004-03-14 08:34:32.000000000 +0000
+++ examples/sndfile-play.c
@@ -27,16 +27,21 @@
#include <unistd.h>
#endif
-#if defined (__linux__)
+#if defined (__linux__) || defined(USE_OSS)
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/soundcard.h>
+ #ifndef DEV_DSP
+ #define DEV_DSP "/dev/dsp"
+ #endif
+
#elif (defined (__MACH__) && defined (__APPLE__))
#include <Carbon.h>
#include <CoreAudio/AudioHardware.h>
-#elif (defined (sun) && defined (unix))
+#elif (defined (sun) && defined (unix)) || \
+ (defined (__NetBSD__) && !defined(USE_OSS))
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/audioio.h>
@@ -58,7 +63,7 @@
** Linux/OSS functions for playing a sound.
*/
-#if defined (__linux__)
+#if defined (__linux__) || defined(USE_OSS)
static int linux_open_dsp_device (int channels, int srate) ;
@@ -121,7 +126,7 @@ static int
linux_open_dsp_device (int channels, int srate)
{ int fd, stereo, temp, error ;
- if ((fd = open ("/dev/dsp", O_WRONLY, 0)) == -1 &&
+ if ((fd = open (DEV_DSP, O_WRONLY, 0)) == -1 &&
(fd = open ("/dev/sound/dsp", O_WRONLY, 0)) == -1)
{ perror("linux_open_dsp_device : open ") ;
exit (1) ;
@@ -487,7 +492,8 @@ win32_play (int argc, char *argv [])
** Solaris.
*/
-#if (defined (sun) && defined (unix)) /* ie Solaris */
+#if (defined (sun) && defined (unix)) || \
+ (defined (__NetBSD__) && !defined(USE_OSS))
static void
solaris_play (int argc, char *argv [])
@@ -594,7 +600,7 @@ main (int argc, char *argv [])
return 1 ;
} ;
-#if defined (__linux__)
+#if defined (__linux__) || defined(USE_OSS)
#if (defined (HAVE_ALSA) && HAVE_ALSA)
if (access ("/proc/asound/cards", R_OK) == 0)
alsa_play (argc, argv) ;
@@ -603,7 +609,8 @@ main (int argc, char *argv [])
#endif
#elif (defined (__MACH__) && defined (__APPLE__))
macosx_play (argc, argv) ;
-#elif (defined (sun) && defined (unix))
+#elif (defined (sun) && defined (unix)) || \
+ (defined (__NetBSD__) && !defined(USE_OSS))
solaris_play (argc, argv) ;
#elif WIN32_WITH_MMREG_H
win32_play (argc, argv) ;
|