changeset 755:b1595db396a7

Date: Fri, 12 Dec 2003 11:51:21 +0900 From: Hayashi Naoyuki Subject: Tru64 audio(mme) fix ./src/audio/mme/SDL_mmeaudio.c Fix the sound skip problem which is caused even if it recover from high load.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 14 Dec 2003 06:28:07 +0000
parents 623b453a3219
children 10332c6fad2e
files src/audio/mme/SDL_mmeaudio.c
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/audio/mme/SDL_mmeaudio.c	Sun Dec 14 06:25:53 2003 +0000
+++ b/src/audio/mme/SDL_mmeaudio.c	Sun Dec 14 06:28:07 2003 +0000
@@ -191,17 +191,16 @@
 
 static void MME_WaitAudio(_THIS)
 {
-    mmeWaitForCallbacks ();
-    mmeProcessCallbacks ();
+    while ( inUse[next_buffer] ) {
+	mmeWaitForCallbacks();
+	mmeProcessCallbacks();
+    }
 }
 
 static Uint8 *MME_GetAudioBuf(_THIS)
 {
     Uint8 *retval;
 
-    while ( inUse[next_buffer] )
-	;
-
     inUse[next_buffer] = TRUE;
     retval = (Uint8 *)(shm->wHdr[next_buffer].lpData);
     return retval;
@@ -220,13 +219,15 @@
     int i;
 
     if ( shm->sound ) {
+	for (i = 0; i < NUM_BUFFERS; i++)
+	    while ( inUse[i] ) {
+		mmeWaitForCallbacks();
+		mmeProcessCallbacks();
+	    }
 	result = waveOutReset(shm->sound);
 	if ( result != MMSYSERR_NOERROR )
 	    SetMMerror("waveOutReset()", result);
-	else {
-	    mmeWaitForCallbacks ();
-	    mmeProcessCallbacks ();
-	}
+	mmeProcessCallbacks();
     }
 }
 
@@ -246,6 +247,7 @@
 	    result = waveOutClose(shm->sound);
 	    if (result != MMSYSERR_NOERROR )
 		SetMMerror("waveOutClose()", result);
+	    mmeProcessCallbacks();
 	}
 	result = mmeFreeMem(shm);
 	if (result != MMSYSERR_NOERROR )