Index: code/client/snd_openal.c =================================================================== --- code/client/snd_openal.c (revision 1788) +++ code/client/snd_openal.c (working copy) @@ -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; }