diff options
author | Chris Robinson <[email protected]> | 2017-04-20 23:21:46 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-04-20 23:21:46 -0700 |
commit | 1e8ea59564d4082e164f2a7707df90b00f48a35b (patch) | |
tree | f62d07412feabdbb9413e16ec19a19db9d9b630a | |
parent | 7776ebcedc780409058b953a932ba854d33ef084 (diff) |
Make the default resampler a variable
-rw-r--r-- | Alc/mixer.c | 17 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 3 |
2 files changed, 10 insertions, 10 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c index f326fdfe..b1d014a7 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -49,6 +49,8 @@ static_assert(MAX_PRE_SAMPLES >= 11, "MAX_PRE_SAMPLES must be at least 11!"); static_assert(MAX_POST_SAMPLES >= 12, "MAX_POST_SAMPLES must be at least 12!"); +enum Resampler ResamplerDefault = LinearResampler; + static MixerFunc MixSamples = Mix_C; static HrtfMixerFunc MixHrtfSamples = MixHrtf_C; static ResamplerFunc ResampleSamples = Resample_point32_C; @@ -145,30 +147,29 @@ ResamplerFunc SelectResampler(enum Resampler resampler) void aluInitMixer(void) { - enum Resampler resampler = ResamplerDefault; const char *str; if(ConfigValueStr(NULL, NULL, "resampler", &str)) { if(strcasecmp(str, "point") == 0 || strcasecmp(str, "none") == 0) - resampler = PointResampler; + ResamplerDefault = PointResampler; else if(strcasecmp(str, "linear") == 0) - resampler = LinearResampler; + ResamplerDefault = LinearResampler; else if(strcasecmp(str, "sinc4") == 0) - resampler = FIR4Resampler; + ResamplerDefault = FIR4Resampler; else if(strcasecmp(str, "bsinc") == 0) - resampler = BSincResampler; + ResamplerDefault = BSincResampler; else if(strcasecmp(str, "cubic") == 0 || strcasecmp(str, "sinc8") == 0) { WARN("Resampler option \"%s\" is deprecated, using sinc4\n", str); - resampler = FIR4Resampler; + ResamplerDefault = FIR4Resampler; } else { char *end; long n = strtol(str, &end, 0); if(*end == '\0' && (n == PointResampler || n == LinearResampler || n == FIR4Resampler)) - resampler = n; + ResamplerDefault = n; else WARN("Invalid resampler: %s\n", str); } @@ -176,7 +177,7 @@ void aluInitMixer(void) MixHrtfSamples = SelectHrtfMixer(); MixSamples = SelectMixer(); - ResampleSamples = SelectResampler(resampler); + ResampleSamples = SelectResampler(ResamplerDefault); } diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 96c7d4c4..9b267d15 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -369,9 +369,8 @@ enum Resampler { LinearResampler, FIR4Resampler, BSincResampler, - - ResamplerDefault = LinearResampler }; +extern enum Resampler ResamplerDefault; enum HrtfRequestMode { Hrtf_Default = 0, |