dsound patch

Ove Kaaven ovehk at ping.uio.no
Sat Sep 8 08:33:50 CDT 2001


May as well submit this...

Log:
Ove Kaaven <ovek at transgaming.com>
Fix buffering problems in HEL mode.

Index: dlls/dsound/dsound_main.c
===================================================================
RCS file: /cvsroot/winex/wine/dlls/dsound/dsound_main.c,v
retrieving revision 1.1.1.13
retrieving revision 1.29
diff -u -r1.1.1.13 -r1.29
--- dlls/dsound/dsound_main.c	2001/08/29 18:14:57	1.1.1.13
+++ dlls/dsound/dsound_main.c	2001/08/29 19:37:07	1.29
@@ -2047,6 +2047,11 @@
 			primarybuf->dsbd.dwFlags = dsbd->dwFlags;
 			return DS_OK;
 		} /* Else create primary buffer */
+	} else {
+		if (dsbd->dwBufferBytes < DSBSIZE_MIN || dsbd->dwBufferBytes > DSBSIZE_MAX) {
+			ERR("invalid sound buffer size %ld\n", dsbd->dwBufferBytes);
+			return DSERR_INVALIDPARAM; /* FIXME: which error? */
+		}
 	}
 
 	*ippdsb = (IDirectSoundBufferImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirectSoundBufferImpl));
@@ -3214,6 +3219,10 @@
 				mixq++;
 		} else mixq = 0;
 		if (forced) mixq = DS_SND_QUEUE;
+
+                /* Make sure that we don't rewrite any fragments that have already been
+                   written and are waiting to be played */
+                mixq = (dsound->pwqueue > mixq) ? 0 : (mixq - dsound->pwqueue);
 
 		/* output it */
 		for (; mixq; mixq--) {
Index: include/dsound.h
===================================================================
RCS file: /cvsroot/winex/wine/include/dsound.h,v
retrieving revision 1.1.1.2
retrieving revision 1.3
diff -u -r1.1.1.2 -r1.3
--- include/dsound.h	2001/08/29 18:21:51	1.1.1.2
+++ include/dsound.h	2001/08/29 19:37:08	1.3
@@ -130,6 +130,8 @@
 #define DSBCAPS_GETCURRENTPOSITION2 0x00010000  /* More accurate play cursor under emulation*/
 #define DSBCAPS_MUTE3DATMAXDISTANCE 0x00020000
 
+#define DSBSIZE_MIN                 4
+#define DSBSIZE_MAX                 0xFFFFFFF
 #define DSBPAN_LEFT                 -10000
 #define DSBPAN_RIGHT                 10000
 #define DSBVOLUME_MAX                    0





More information about the wine-patches mailing list