3b347872f8
* Add support for FLAC and Apple's Core Audio Format (CAF). * Add virtual I/O interface (still needs docs). * Cygwin and other Win32 fixes. * Minor bug fixes and cleanups.
75 lines
2.2 KiB
Text
75 lines
2.2 KiB
Text
$NetBSD: patch-ac,v 1.7 2005/09/30 13:26:02 adam Exp $
|
|
|
|
--- examples/sndfile-play.c.orig 2005-09-04 00:11:38.000000000 +0000
|
|
+++ examples/sndfile-play.c
|
|
@@ -34,16 +34,21 @@
|
|
#include <sys/time.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>
|
|
@@ -339,7 +344,7 @@ alsa_write_float (snd_pcm_t *alsa_dev, f
|
|
** 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) ;
|
|
|
|
@@ -408,7 +413,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) ;
|
|
@@ -819,7 +824,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 [])
|
|
@@ -926,7 +932,7 @@ main (int argc, char *argv [])
|
|
return 1 ;
|
|
} ;
|
|
|
|
-#if defined (__linux__)
|
|
+#if defined (__linux__) || defined (USE_OSS)
|
|
#if HAVE_ALSA_ASOUNDLIB_H
|
|
if (access ("/proc/asound/cards", R_OK) == 0)
|
|
alsa_play (argc, argv) ;
|
|
@@ -935,7 +941,8 @@ main (int argc, char *argv [])
|
|
linux_play (argc, argv) ;
|
|
#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 (OS_IS_WIN32 == 1)
|
|
win32_play (argc, argv) ;
|