From c93238fb57fd63cb0d0d5156b0f22f2ea8d980fb Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Thu, 20 Jan 2005 08:16:52 +0000
Subject: [PATCH] Alternate method for detecting end of playback.

---
 src/xpdev/xpbeep.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/xpdev/xpbeep.c b/src/xpdev/xpbeep.c
index bd535458f2..3ef8b18e8f 100644
--- a/src/xpdev/xpbeep.c
+++ b/src/xpdev/xpbeep.c
@@ -152,11 +152,9 @@ void SineBeep(double freq, DWORD duration)
 		goto abrt;
 	if(waveOutWrite(waveOut, &wh, sizeof(wh))!=MMSYSERR_NOERROR)
 		goto abrt;
-	while(!(wh.dwFlags&WHDR_DONE))
-		SLEEP(1);
 abrt:
-	waveOutUnprepareHeader(waveOut, &wh, sizeof(wh));
-	waveOutReset(waveOut);
+	while(waveOutUnprepareHeader(waveOut, &wh, sizeof(wh))==WAVERR_STILLPLAYING)
+		SLEEP(1);
 	waveOutClose(waveOut);
 }
 
-- 
GitLab