[quake3-commits] r1663 - trunk/code/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Oct 13 11:23:18 EDT 2009


Author: thilo
Date: 2009-10-13 11:23:17 -0400 (Tue, 13 Oct 2009)
New Revision: 1663

Modified:
   trunk/code/client/snd_openal.c
Log:
Improve OpenAL error handling, patch by Ben Millwood. https://bugzilla.icculus.org/show_bug.cgi?id=3776


Modified: trunk/code/client/snd_openal.c
===================================================================
--- trunk/code/client/snd_openal.c	2009-10-13 15:22:43 UTC (rev 1662)
+++ trunk/code/client/snd_openal.c	2009-10-13 15:23:17 UTC (rev 1663)
@@ -98,7 +98,23 @@
 	}
 }
 
+/*
+=================
+S_AL_ClearError
+=================
+*/
+static void S_AL_ClearError( qboolean quiet )
+{
+	int error = qalGetError();
 
+	if( quiet )
+		return;
+	if(error != AL_NO_ERROR)
+		Com_Printf(S_COLOR_YELLOW "WARNING: unhandled AL error: %s\n",
+			S_AL_ErrorMsg(error));
+}
+
+
 //===========================================================================
 
 
@@ -217,7 +233,8 @@
 	if(!knownSfx[sfx].inMemory)
 		return;
 
-	// Delete it
+	// Delete it 
+	S_AL_ClearError( qfalse );
 	qalDeleteBuffers(1, &knownSfx[sfx].buffer);
 	if((error = qalGetError()) != AL_NO_ERROR)
 		Com_Printf( S_COLOR_RED "ERROR: Can't delete sound buffer for %s\n",
@@ -296,6 +313,7 @@
 	format = S_AL_Format(info.width, info.channels);
 
 	// Create a buffer
+	S_AL_ClearError( qfalse );
 	qalGenBuffers(1, &knownSfx[sfx].buffer);
 	if((error = qalGetError()) != AL_NO_ERROR)
 	{
@@ -613,7 +631,8 @@
 		limit = MAX_SRC;
 	else if(limit < 16)
 		limit = 16;
-
+ 
+	S_AL_ClearError( qfalse );
 	// Allocate as many sources as possible
 	for(i = 0; i < limit; i++)
 	{
@@ -1536,6 +1555,8 @@
 	ALuint format;
 	snd_stream_t *curstream;
 
+	S_AL_ClearError( qfalse );
+
 	if(intro_stream)
 		curstream = intro_stream;
 	else



More information about the quake3-commits mailing list