aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-12-20 01:36:01 -0800
committerChris Robinson <[email protected]>2011-12-20 01:36:01 -0800
commit2691c33b555a8e60f6a0ba44c59fb7e167d1e5bd (patch)
tree69fa7dbae91f30588efa3b64db3d5ae86dc22d46
parent7f6844e48d32225eadd1e918fd0bbb84170a6b15 (diff)
Use a string to specify the resampler config option
-rw-r--r--Alc/ALc.c22
-rw-r--r--alsoftrc.sample8
2 files changed, 22 insertions, 8 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 93688d5c..01d4ddd5 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -583,10 +583,24 @@ static void alc_initconfig(void)
#endif
ConfigValueInt(NULL, "rt-prio", &RTPrioLevel);
- if(ConfigValueInt(NULL, "resampler", &n))
- {
- if(n < RESAMPLER_MAX && n > RESAMPLER_MIN)
- DefaultResampler = n;
+ if(ConfigValueStr(NULL, "resampler", &str))
+ {
+ if(strcasecmp(str, "point") == 0 || strcasecmp(str, "none") == 0)
+ DefaultResampler = POINT_RESAMPLER;
+ else if(strcasecmp(str, "linear") == 0)
+ DefaultResampler = LINEAR_RESAMPLER;
+ else if(strcasecmp(str, "cubic") == 0)
+ DefaultResampler = CUBIC_RESAMPLER;
+ else
+ {
+ char *end;
+
+ n = strtol(str, &end, 0);
+ if(*end == '\0' && n < RESAMPLER_MAX && n > RESAMPLER_MIN)
+ DefaultResampler = n;
+ else
+ WARN("Invalid resampler: %s\n", str);
+ }
}
if(!TrapALCError)
diff --git a/alsoftrc.sample b/alsoftrc.sample
index abaa628c..e153212b 100644
--- a/alsoftrc.sample
+++ b/alsoftrc.sample
@@ -61,11 +61,11 @@
## resampler:
# Selects the resampler used when mixing sources. Valid values are:
-# 0 - None (nearest sample, no interpolation)
-# 1 - Linear (extrapolates samples using a linear slope between samples)
-# 2 - Cubic (extrapolates samples using a Catmull-Rom spline)
+# point - nearest sample, no interpolation
+# linear - extrapolates samples using a linear slope between samples
+# cubic - extrapolates samples using a Catmull-Rom spline
# Specifying other values will result in using the default (linear).
-#resampler = 1
+#resampler = linear
## rt-prio:
# Sets real-time priority for the mixing thread. Not all drivers may use this