From f324fd7ab4639210ad1b2c95a2381c65ebee2e3c Mon Sep 17 00:00:00 2001 From: thilo Date: Tue, 13 Oct 2009 15:23:17 +0000 Subject: Improve OpenAL error handling, patch by Ben Millwood. https://bugzilla.icculus.org/show_bug.cgi?id=3776 git-svn-id: svn://svn.icculus.org/quake3/trunk@1663 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/client/snd_openal.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/code/client/snd_openal.c b/code/client/snd_openal.c index 5087b72..45b1398 100644 --- a/code/client/snd_openal.c +++ b/code/client/snd_openal.c @@ -98,6 +98,22 @@ static const char *S_AL_ErrorMsg(ALenum error) } } +/* +================= +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 @@ static void S_AL_BufferUnload(sfxHandle_t sfx) 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 @@ static void S_AL_BufferLoad(sfxHandle_t sfx) 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 @@ qboolean S_AL_SrcInit( void ) 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 @@ void S_AL_MusicProcess(ALuint b) ALuint format; snd_stream_t *curstream; + S_AL_ClearError( qfalse ); + if(intro_stream) curstream = intro_stream; else -- cgit v1.2.3