changeset 35469:539bfa51eb72

ao_dsound: Add a hack that avoid cutting of audio, even when the drivers do not report status correctly.
author reimar
date Sun, 02 Dec 2012 21:39:29 +0000
parents 047fc4746236
children 116dbb38eac0
files libao2/ao_dsound.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_dsound.c	Sun Dec 02 15:59:55 2012 +0000
+++ b/libao2/ao_dsound.c	Sun Dec 02 21:39:29 2012 +0000
@@ -568,6 +568,11 @@
 	else{
 		DWORD status;
 		IDirectSoundBuffer_Play(hdsbuf, 0, 0, 0);
+		// This should not be necessary, but a lot of drivers
+		// do not correctly report the status here, causing
+		// audio to be discarded. So we sleep approximately
+		// the right amount of time first.
+		usec_sleep(get_delay() * 1000 * 1000);
 		while(!IDirectSoundBuffer_GetStatus(hdsbuf,&status) && (status&DSBSTATUS_PLAYING))
 			usec_sleep(20000);
 	}