From 9dd3684e43980c4bd96be8eba572a1228ff3e404 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Thu, 20 Jan 2005 07:43:53 +0000
Subject: [PATCH] Undo last change... DO NOT DO DSP WHILE TIRED!  :-)

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

diff --git a/src/xpdev/xpbeep.c b/src/xpdev/xpbeep.c
index 369dae5f43..bd535458f2 100644
--- a/src/xpdev/xpbeep.c
+++ b/src/xpdev/xpbeep.c
@@ -60,7 +60,7 @@ void makesine(double freq, unsigned char *wave, int samples)
 		wave[i]=127;
 	}
 	/* Fade out */
-	for(k=2;k<=10;k++) {
+	for(k=10;k>1;k--) {
 		for(;i>0;i--) {
 			if(!endhigh && wave[i]<=127)
 				break;
@@ -96,7 +96,7 @@ void makesine(double freq, unsigned char *wave, int samples)
 		wave[i]=127;
 	}
 	/* Fade in */
-	for(k=2;k<=10;k++) {
+	for(k=10;k>1;k--) {
 		for(;i<samples;i--) {
 			if(!starthigh && wave[i]<=127)
 				break;
@@ -152,7 +152,8 @@ void SineBeep(double freq, DWORD duration)
 		goto abrt;
 	if(waveOutWrite(waveOut, &wh, sizeof(wh))!=MMSYSERR_NOERROR)
 		goto abrt;
-	SLEEP(duration);
+	while(!(wh.dwFlags&WHDR_DONE))
+		SLEEP(1);
 abrt:
 	waveOutUnprepareHeader(waveOut, &wh, sizeof(wh));
 	waveOutReset(waveOut);
-- 
GitLab