Use a string to specify the resampler config option

This commit is contained in:
Chris Robinson
2011-12-20 01:36:01 -08:00
parent 7f6844e48d
commit 2691c33b55
2 changed files with 21 additions and 7 deletions
+17 -3
View File
@@ -583,10 +583,24 @@ static void alc_initconfig(void)
#endif
ConfigValueInt(NULL, "rt-prio", &RTPrioLevel);
if(ConfigValueInt(NULL, "resampler", &n))
if(ConfigValueStr(NULL, "resampler", &str))
{
if(n < RESAMPLER_MAX && n > RESAMPLER_MIN)
DefaultResampler = n;
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)
+4 -4
View File
@@ -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