From 2691c33b555a8e60f6a0ba44c59fb7e167d1e5bd Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 20 Dec 2011 01:36:01 -0800 Subject: Use a string to specify the resampler config option --- Alc/ALc.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'Alc/ALc.c') 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) -- cgit v1.2.3