Use proper API to get pointers to OpenAL EFX extensions

This commit is contained in:
bibendovsky 2014-06-10 10:23:43 +03:00
parent 6c3fb38721
commit a53f321bed
2 changed files with 25 additions and 6 deletions

View file

@ -455,12 +455,6 @@ QAL_Init()
qalDopplerVelocity = Sys_GetProcAddress(handle, "alDopplerVelocity");
qalSpeedOfSound = Sys_GetProcAddress(handle, "alSpeedOfSound");
qalDistanceModel = Sys_GetProcAddress(handle, "alDistanceModel");
#if !defined (__APPLE__)
qalGenFilters = Sys_GetProcAddress(handle, "alGenFilters");
qalFilteri = Sys_GetProcAddress(handle, "alFilteri");
qalFilterf = Sys_GetProcAddress(handle, "alFilterf");
qalDeleteFilters = Sys_GetProcAddress(handle, "alDeleteFilters");
#endif
/* Open the OpenAL device */
Com_Printf("...opening OpenAL device:");
@ -500,6 +494,20 @@ QAL_Init()
return false;
}
#if !defined (__APPLE__)
if (qalcIsExtensionPresent(device, "ALC_EXT_EFX") != AL_FALSE) {
qalGenFilters = qalGetProcAddress("alGenFilters");
qalFilteri = qalGetProcAddress("alFilteri");
qalFilterf = qalGetProcAddress("alFilterf");
qalDeleteFilters = qalGetProcAddress("alDeleteFilters");
} else {
qalGenFilters = NULL;
qalFilteri = NULL;
qalFilterf = NULL;
qalDeleteFilters = NULL;
}
#endif
Com_Printf("ok\n");
/* Print OpenAL informations */

View file

@ -624,6 +624,9 @@ AL_Underwater()
return;
}
if (underwaterFilter == 0)
return;
/* Apply to all sources */
for (i = 0; i < s_numchannels; i++)
{
@ -646,6 +649,9 @@ AL_Overwater()
return;
}
if (underwaterFilter == 0)
return;
/* Apply to all sources */
for (i = 0; i < s_numchannels; i++)
{
@ -678,6 +684,11 @@ static void
AL_InitUnderwaterFilter()
{
#if !defined (__APPLE__)
underwaterFilter = 0;
if (!(qalGenFilters && qalFilteri && qalFilterf && qalDeleteFilters))
return;
/* Generate a filter */
qalGenFilters(1, &underwaterFilter);