aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2015-10-01 00:34:13 -0700
committerChris Robinson <[email protected]>2015-10-01 00:34:13 -0700
commit07f80eb4e1ba0839ae97fac0914855c239c4ea1f (patch)
tree75b38bc640ace778979b6bb04e428255ff1749dc /Alc
parentd5675d5395cc8eb4df60a147e0f5caba48fbf68f (diff)
Move the resampler stuff to mixer.c where it's used
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c25
-rw-r--r--Alc/mixer.c53
2 files changed, 53 insertions, 25 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index b9c01128..77f263ca 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1003,31 +1003,6 @@ static void alc_initconfig(void)
#endif
ConfigValueInt(NULL, NULL, "rt-prio", &RTPrioLevel);
- if(ConfigValueStr(NULL, NULL, "resampler", &str))
- {
- if(strcasecmp(str, "point") == 0 || strcasecmp(str, "none") == 0)
- DefaultResampler = PointResampler;
- else if(strcasecmp(str, "linear") == 0)
- DefaultResampler = LinearResampler;
- else if(strcasecmp(str, "sinc4") == 0)
- DefaultResampler = FIR4Resampler;
- else if(strcasecmp(str, "sinc6") == 0)
- DefaultResampler = FIR6Resampler;
- else if(strcasecmp(str, "cubic") == 0)
- {
- WARN("Resampler option \"cubic\" is deprecated, using sinc4\n");
- DefaultResampler = FIR4Resampler;
- }
- else
- {
- char *end;
- n = strtol(str, &end, 0);
- if(*end == '\0' && (n == PointResampler || n == LinearResampler || n == FIR4Resampler))
- DefaultResampler = n;
- else
- WARN("Invalid resampler: %s\n", str);
- }
- }
aluInitMixer();
str = getenv("ALSOFT_TRAP_ERROR");
diff --git a/Alc/mixer.c b/Alc/mixer.c
index dedcb5b9..27d8cbcf 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -46,6 +46,31 @@ extern inline void InitiatePositionArrays(ALuint frac, ALuint increment, ALuint
alignas(16) union ResamplerCoeffs ResampleCoeffs;
+enum Resampler {
+ PointResampler,
+ LinearResampler,
+ FIR4Resampler,
+ FIR6Resampler,
+
+ ResamplerMax,
+};
+
+static enum Resampler DefaultResampler = LinearResampler;
+
+static const ALsizei ResamplerPadding[ResamplerMax] = {
+ 0, /* Point */
+ 1, /* Linear */
+ 2, /* FIR4 */
+ 3, /* FIR6 */
+};
+static const ALsizei ResamplerPrePadding[ResamplerMax] = {
+ 0, /* Point */
+ 0, /* Linear */
+ 1, /* FIR4 */
+ 2, /* FIR6 */
+};
+
+
static HrtfMixerFunc MixHrtfSamples = MixHrtf_C;
static MixerFunc MixSamples = Mix_C;
static ResamplerFunc ResampleSamples = Resample_point32_C;
@@ -127,7 +152,35 @@ static float lanc(float r, float x)
void aluInitMixer(void)
{
+ const char *str;
ALuint i;
+
+ if(ConfigValueStr(NULL, NULL, "resampler", &str))
+ {
+ if(strcasecmp(str, "point") == 0 || strcasecmp(str, "none") == 0)
+ DefaultResampler = PointResampler;
+ else if(strcasecmp(str, "linear") == 0)
+ DefaultResampler = LinearResampler;
+ else if(strcasecmp(str, "sinc4") == 0)
+ DefaultResampler = FIR4Resampler;
+ else if(strcasecmp(str, "sinc6") == 0)
+ DefaultResampler = FIR6Resampler;
+ else if(strcasecmp(str, "cubic") == 0)
+ {
+ WARN("Resampler option \"cubic\" is deprecated, using sinc4\n");
+ DefaultResampler = FIR4Resampler;
+ }
+ else
+ {
+ char *end;
+ long n = strtol(str, &end, 0);
+ if(*end == '\0' && (n == PointResampler || n == LinearResampler || n == FIR4Resampler))
+ DefaultResampler = n;
+ else
+ WARN("Invalid resampler: %s\n", str);
+ }
+ }
+
if(DefaultResampler == FIR6Resampler)
for(i = 0;i < FRACTIONONE;i++)
{