aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2008-11-14 07:13:59 -0800
committerChris Robinson <[email protected]>2008-11-14 07:13:59 -0800
commitd72b132c57145bd6cd4c531fe0a8c65b348c2c29 (patch)
tree910ffeef08d6b278e12da0032867efed2bb58ee7
parent506912aed7a1ae84fbc0407741c85ac2d5e109d2 (diff)
Add an option to disable specific EFX effect types
-rw-r--r--Alc/ALc.c31
-rw-r--r--OpenAL32/Include/alEffect.h7
-rw-r--r--OpenAL32/alEffect.c10
-rw-r--r--alsoftrc.sample6
4 files changed, 52 insertions, 2 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 9fe51c1c..3913fcae 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -309,6 +309,37 @@ static void InitAL(void)
strcasecmp(str, "yes") == 0 ||
strcasecmp(str, "on") == 0 ||
atoi(str) != 0);
+
+ str = GetConfigValue(NULL, "excludefx", "");
+ if(str[0])
+ {
+ const struct {
+ const char *name;
+ int type;
+ } EffectList[] = {
+ { "reverb", REVERB },
+ { NULL, 0 }
+ };
+ int n;
+ size_t len;
+ const char *next = str;
+
+ do {
+ str = next;
+ next = strchr(str, ',');
+
+ if(!str[0] || next == str)
+ continue;
+
+ len = (next ? ((size_t)(next-str)) : strlen(str));
+ for(n = 0;EffectList[n].name;n++)
+ {
+ if(len == strlen(EffectList[n].name) &&
+ strncmp(EffectList[n].name, str, len) == 0)
+ DisabledEffects[EffectList[n].type] = AL_TRUE;
+ }
+ } while(next++);
+ }
}
}
diff --git a/OpenAL32/Include/alEffect.h b/OpenAL32/Include/alEffect.h
index 24f12c5e..5f6723bc 100644
--- a/OpenAL32/Include/alEffect.h
+++ b/OpenAL32/Include/alEffect.h
@@ -38,6 +38,13 @@ extern "C" {
#define AL_REVERB_DECAY_HFLIMIT 0x000D
+enum {
+ REVERB = 0,
+ MAX_EFFECTS
+};
+extern ALboolean DisabledEffects[MAX_EFFECTS];
+
+
typedef struct ALeffect_struct
{
// Effect type (AL_EFFECT_NULL, ...)
diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c
index 8f52bcaf..939b663f 100644
--- a/OpenAL32/alEffect.c
+++ b/OpenAL32/alEffect.c
@@ -29,6 +29,10 @@
#include "alThunk.h"
#include "alError.h"
+
+ALboolean DisabledEffects[MAX_EFFECTS];
+
+
static ALeffect *g_EffectList;
static ALuint g_EffectCount;
@@ -165,8 +169,10 @@ ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue)
if(param == AL_EFFECT_TYPE)
{
- if(iValue == AL_EFFECT_NULL ||
- iValue == AL_EFFECT_REVERB)
+ ALboolean isOk = (iValue == AL_EFFECT_NULL ||
+ (iValue == AL_EFFECT_REVERB && !DisabledEffects[REVERB]));
+
+ if(isOk)
InitEffectParams(ALEffect, iValue);
else
alSetError(AL_INVALID_VALUE);
diff --git a/alsoftrc.sample b/alsoftrc.sample
index 9fd96eee..87cb88b6 100644
--- a/alsoftrc.sample
+++ b/alsoftrc.sample
@@ -61,6 +61,12 @@ drivers = # Sets the backend driver list order, comma-seperated. Unknown
# Default is:
# alsa,oss,solaris,dsound,winmm,wave
+excludefx = # Sets which effects to exclude, preventing apps from using them.
+ # This can help for apps that try to use effects which are too CPU
+ # intensive for the system to handle. Available effects are:
+ # reverb
+ # Default is empty (all available effects enabled)
+
[alsa] # ALSA backend stuff
device = default # Sets the device name for the default playback device.
# Default is default