[quake3-commits] r1792 - trunk/code/client
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sun Aug 29 14:11:15 EDT 2010
Author: thilo
Date: 2010-08-29 14:11:15 -0400 (Sun, 29 Aug 2010)
New Revision: 1792
Modified:
trunk/code/client/snd_openal.c
Log:
Fix "unhandles OpenAL error", and sound fallback behaviour for model files. Thanks Ansa89 for reporting, and Zack Middleton for the patch.
Modified: trunk/code/client/snd_openal.c
===================================================================
--- trunk/code/client/snd_openal.c 2010-08-29 18:08:29 UTC (rev 1791)
+++ trunk/code/client/snd_openal.c 2010-08-29 18:11:15 UTC (rev 1792)
@@ -127,6 +127,7 @@
snd_info_t info; // information for this sound like rate, sample count..
qboolean isDefault; // Couldn't be loaded - use default FX
+ qboolean isDefaultChecked; // Sound has been check if it isDefault
qboolean inMemory; // Sound is stored in memory
qboolean isLocked; // Sound is locked (can not be unloaded)
int lastUsedTime; // Time last used
@@ -291,7 +292,7 @@
S_AL_BufferLoad
=================
*/
-static void S_AL_BufferLoad(sfxHandle_t sfx)
+static void S_AL_BufferLoad(sfxHandle_t sfx, qboolean cache)
{
ALenum error;
ALuint format;
@@ -309,7 +310,7 @@
return;
// Already done?
- if((curSfx->inMemory) || (curSfx->isDefault))
+ if((curSfx->inMemory) || (curSfx->isDefault) || (!cache && curSfx->isDefaultChecked))
return;
// Try to load
@@ -320,6 +321,15 @@
return;
}
+ curSfx->isDefaultChecked = qtrue;
+
+ if (!cache)
+ {
+ // Don't create AL cache
+ Z_Free(data);
+ return;
+ }
+
format = S_AL_Format(info.width, info.channels);
// Create a buffer
@@ -394,7 +404,7 @@
return;
if((!knownSfx[sfx].inMemory) && (!knownSfx[sfx].isDefault))
- S_AL_BufferLoad(sfx);
+ S_AL_BufferLoad(sfx, qtrue);
knownSfx[sfx].lastUsedTime = Sys_Milliseconds();
}
@@ -460,10 +470,14 @@
{
sfxHandle_t sfx = S_AL_BufferFind(sample);
- if( s_alPrecache->integer && (!knownSfx[sfx].inMemory) && (!knownSfx[sfx].isDefault))
- S_AL_BufferLoad(sfx);
+ if((!knownSfx[sfx].inMemory) && (!knownSfx[sfx].isDefault))
+ S_AL_BufferLoad(sfx, s_alPrecache->integer);
knownSfx[sfx].lastUsedTime = Com_Milliseconds();
+ if (knownSfx[sfx].isDefault) {
+ return 0;
+ }
+
return sfx;
}
More information about the quake3-commits
mailing list