pkgsrc-wip/mupen64-plugin-sound/patches/patch-ab
Blue Rats 40393dfd6c Install to DESTDIR. Commented patches and regenerated distinfo.
Moved INSTALL_DATA_DIR to INSTALLATION_DIRS in Makefile.
2012-12-27 06:09:33 +00:00

42 lines
1.1 KiB
Text

$NetBSD: patch-ab,v 1.2 2012/12/27 06:09:34 othyro Exp $
Add NetBSD soundcard support and fix audio device.
--- main.c.orig 2003-08-08 23:31:44.000000000 +0000
+++ main.c
@@ -6,7 +6,13 @@
#include <stdlib.h>
#include <fcntl.h>
#include <sys/ioctl.h>
+#if defined(__NetBSD__)
+#include <soundcard.h>
+#elif defined(__Linux__)
#include <linux/soundcard.h>
+#else
+#include <sys/soundcard.h>
+#endif
#include <unistd.h>
#include <pthread.h>
@@ -139,9 +145,9 @@ InitiateAudio( AUDIO_INFO Audio_Info )
EXPORT void CALL RomOpen()
{
int channel=1, format, f;
- dsp = open("/dev/dsp", O_WRONLY);
- if (dsp == -1) printf("error opening /dev/dsp\n");
- if (ioctl(dsp, SNDCTL_DSP_RESET) == -1)
+ dsp = open("/dev/audio", O_WRONLY);
+ if (dsp == -1) printf("error opening /dev/audio\n");
+ if (ioctl(dsp, SNDCTL_DSP_RESET, NULL) == -1)
printf("error resetting sound card\n");
f = 0x30018;
if (ioctl(dsp, SNDCTL_DSP_SETFRAGMENT, &f) == -1)
@@ -162,7 +168,7 @@ EXPORT void CALL RomOpen()
EXPORT void CALL
RomClosed( void )
{
- ioctl(dsp, SNDCTL_DSP_SYNC);
+ ioctl(dsp, SNDCTL_DSP_SYNC, NULL);
close(dsp);
}