Make the default resampler a variable
This commit is contained in:
parent
7776ebcedc
commit
1e8ea59564
17
Alc/mixer.c
17
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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -369,9 +369,8 @@ enum Resampler {
|
||||
LinearResampler,
|
||||
FIR4Resampler,
|
||||
BSincResampler,
|
||||
|
||||
ResamplerDefault = LinearResampler
|
||||
};
|
||||
extern enum Resampler ResamplerDefault;
|
||||
|
||||
enum HrtfRequestMode {
|
||||
Hrtf_Default = 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user