$NetBSD: patch-ad,v 1.4 1998/08/07 10:40:42 agc Exp $

--- mixer.cpp.orig	Thu Dec  5 14:14:44 1996
+++ mixer.cpp	Mon Aug  3 01:01:04 1998
@@ -182,7 +182,7 @@
 	}
 
 /* Do some system specific initialization */
-#ifdef linux
+#if defined(linux) || defined(__NetBSD__)
 #ifndef PLAY_DEV_AUDIO		/* VoxWare */
 	if ( ioctl(dsp_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 0 ) {
 		if ( complain )
@@ -285,7 +285,7 @@
 	/* This is necessary so that the sound server stays in sync */
 	long flags;
 	flags = fcntl(dsp_fd, F_GETFL, 0);
-	flags |= O_SYNC;
+/*	flags |= O_SYNC;*/
 	(void) fcntl(dsp_fd, F_SETFL, flags);
 
 	return(0);
@@ -539,7 +539,7 @@
 			error("Mixer::Play: ALwritesamps (Play) failed!\n");
 		}
 #else  /* Normal device write */
-#ifdef sparc
+#if defined(sparc) && !defined(__NetBSD__)
 	drain_it:
 		if ( ioctl(dsp_fd, AUDIO_DRAIN, 0) < 0 ) {
 			if ( errno == EINTR )
@@ -549,13 +549,14 @@
 	write_frag:
 		if ( write(dsp_fd, clipped, frag_size*(AUDIO_BITS/8))
 						!= frag_size*(AUDIO_BITS/8) ) {
-			if ( errno == EINTR )  // Interrupted system call...
+			if ( errno == EINTR)  // Interrupted system call...
 				// This should happen (SA_RESTART)
 				goto write_frag;
-			else {
-				perror("Mixer: Can't write to audio device");
-				return;
-			}
+			else
+				if ( errno != EAGAIN) {
+					perror("Mixer: Can't write to audio device");
+					return;
+				}
 		}
 #endif /* Not SGI Source */
 	} else
