mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-12-14 14:11:15 +00:00
Fix "unhandles OpenAL error", and sound fallback behaviour for model files. Thanks Ansa89 for reporting, and Zack Middleton for the patch.
This commit is contained in:
parent
5fe2a61910
commit
eb2860f756
1 changed files with 19 additions and 5 deletions
|
@ -127,6 +127,7 @@ typedef struct alSfx_s
|
||||||
snd_info_t info; // information for this sound like rate, sample count..
|
snd_info_t info; // information for this sound like rate, sample count..
|
||||||
|
|
||||||
qboolean isDefault; // Couldn't be loaded - use default FX
|
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 inMemory; // Sound is stored in memory
|
||||||
qboolean isLocked; // Sound is locked (can not be unloaded)
|
qboolean isLocked; // Sound is locked (can not be unloaded)
|
||||||
int lastUsedTime; // Time last used
|
int lastUsedTime; // Time last used
|
||||||
|
@ -291,7 +292,7 @@ static qboolean S_AL_BufferEvict( void )
|
||||||
S_AL_BufferLoad
|
S_AL_BufferLoad
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void S_AL_BufferLoad(sfxHandle_t sfx)
|
static void S_AL_BufferLoad(sfxHandle_t sfx, qboolean cache)
|
||||||
{
|
{
|
||||||
ALenum error;
|
ALenum error;
|
||||||
ALuint format;
|
ALuint format;
|
||||||
|
@ -309,7 +310,7 @@ static void S_AL_BufferLoad(sfxHandle_t sfx)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Already done?
|
// Already done?
|
||||||
if((curSfx->inMemory) || (curSfx->isDefault))
|
if((curSfx->inMemory) || (curSfx->isDefault) || (!cache && curSfx->isDefaultChecked))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Try to load
|
// Try to load
|
||||||
|
@ -320,6 +321,15 @@ static void S_AL_BufferLoad(sfxHandle_t sfx)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
curSfx->isDefaultChecked = qtrue;
|
||||||
|
|
||||||
|
if (!cache)
|
||||||
|
{
|
||||||
|
// Don't create AL cache
|
||||||
|
Z_Free(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
format = S_AL_Format(info.width, info.channels);
|
format = S_AL_Format(info.width, info.channels);
|
||||||
|
|
||||||
// Create a buffer
|
// Create a buffer
|
||||||
|
@ -394,7 +404,7 @@ void S_AL_BufferUse(sfxHandle_t sfx)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if((!knownSfx[sfx].inMemory) && (!knownSfx[sfx].isDefault))
|
if((!knownSfx[sfx].inMemory) && (!knownSfx[sfx].isDefault))
|
||||||
S_AL_BufferLoad(sfx);
|
S_AL_BufferLoad(sfx, qtrue);
|
||||||
knownSfx[sfx].lastUsedTime = Sys_Milliseconds();
|
knownSfx[sfx].lastUsedTime = Sys_Milliseconds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,10 +470,14 @@ sfxHandle_t S_AL_RegisterSound( const char *sample, qboolean compressed )
|
||||||
{
|
{
|
||||||
sfxHandle_t sfx = S_AL_BufferFind(sample);
|
sfxHandle_t sfx = S_AL_BufferFind(sample);
|
||||||
|
|
||||||
if( s_alPrecache->integer && (!knownSfx[sfx].inMemory) && (!knownSfx[sfx].isDefault))
|
if((!knownSfx[sfx].inMemory) && (!knownSfx[sfx].isDefault))
|
||||||
S_AL_BufferLoad(sfx);
|
S_AL_BufferLoad(sfx, s_alPrecache->integer);
|
||||||
knownSfx[sfx].lastUsedTime = Com_Milliseconds();
|
knownSfx[sfx].lastUsedTime = Com_Milliseconds();
|
||||||
|
|
||||||
|
if (knownSfx[sfx].isDefault) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return sfx;
|
return sfx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue