diff src/audio/openbsd/SDL_openbsdaudio.c @ 1565:57431b199aed

Fixed bug #52 Integrated most of the NetBSD and DragonFly patches at: ftp://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc/devel/SDL/patches/ Thanks to Thomas Klausner for defailed information on the patches
author Sam Lantinga <slouken@libsdl.org>
date Tue, 21 Mar 2006 08:54:50 +0000
parents d910939febfa
children
line wrap: on
line diff
--- a/src/audio/openbsd/SDL_openbsdaudio.c	Tue Mar 21 07:02:34 2006 +0000
+++ b/src/audio/openbsd/SDL_openbsdaudio.c	Tue Mar 21 08:54:50 2006 +0000
@@ -42,8 +42,12 @@
 #include "../SDL_audiodev_c.h"
 #include "SDL_openbsdaudio.h"
 
-/* The tag name used by OpenBSD audio */
+/* The tag name used by NetBSD/OpenBSD audio */
+#ifdef __NETBSD__
+#define OBSD_DRIVER_NAME         "netbsd"
+#else
 #define OBSD_DRIVER_NAME         "openbsd"
+#endif
 
 /* Open the audio device for playback, and don't block if busy */
 /* #define USE_BLOCKING_WRITES */
@@ -128,7 +132,11 @@
 }
 
 AudioBootStrap OPENBSD_AUDIO_bootstrap = {
+#ifdef __NETBSD__
+	OBSD_DRIVER_NAME, "Native NetBSD audio",
+#else
 	OBSD_DRIVER_NAME, "Native OpenBSD audio",
+#endif
 	Audio_Available, Audio_CreateDevice
 };
 
@@ -136,18 +144,6 @@
 static void
 OBSD_WaitAudio(_THIS)
 {
-	/* Check to see if the thread-parent process is still alive */
-	{ static int cnt = 0;
-		/* Note that this only works with thread implementations 
-		   that use a different process id for each thread.
-		*/
-		if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */
-			if ( kill(parent, 0) < 0 ) {
-				this->enabled = 0;
-			}
-		}
-	}
-
 #ifndef USE_BLOCKING_WRITES /* Not necessary when using blocking writes */
 	/* See if we need to use timed audio synchronization */
 	if ( frame_ticks ) {
@@ -384,6 +380,9 @@
     	spec->channels = 1;
     AUDIO_INITINFO(&info);
     info.play.sample_rate = spec->freq;
+    info.blocksize = spec->size;
+    info.hiwat = 5;
+    info.lowat = 3;
     (void)ioctl(audio_fd, AUDIO_SETINFO, &info);
     (void)ioctl(audio_fd, AUDIO_GETINFO, &info);
     spec->freq  = info.play.sample_rate;