diff --git a/src/backends/generic/qal.c b/src/backends/generic/qal.c index b3eef6db..d908828b 100644 --- a/src/backends/generic/qal.c +++ b/src/backends/generic/qal.c @@ -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 */ diff --git a/src/client/sound/openal.c b/src/client/sound/openal.c index 064b2d1e..991eb838 100644 --- a/src/client/sound/openal.c +++ b/src/client/sound/openal.c @@ -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);