aboutsummaryrefslogtreecommitdiffstats
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
parentd5675d5395cc8eb4df60a147e0f5caba48fbf68f (diff)
Move the resampler stuff to mixer.c where it's used
-rw-r--r--Alc/ALc.c25
-rw-r--r--Alc/mixer.c53
-rw-r--r--OpenAL32/Include/alMain.h9
-rw-r--r--OpenAL32/Include/alSource.h5
-rw-r--r--OpenAL32/alSource.c15
5 files changed, 53 insertions, 54 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++)
{
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 9703a9cf..17ce9122 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -525,15 +525,6 @@ enum DistanceModel {
DefaultDistanceModel = InverseDistanceClamped
};
-enum Resampler {
- PointResampler,
- LinearResampler,
- FIR4Resampler,
- FIR6Resampler,
-
- ResamplerMax,
-};
-
enum Channel {
FrontLeft = 0,
FrontRight,
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index f67d5f3b..89c210b9 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -14,11 +14,6 @@ extern "C" {
struct ALbuffer;
struct ALsource;
-extern enum Resampler DefaultResampler;
-
-extern const ALsizei ResamplerPadding[ResamplerMax];
-extern const ALsizei ResamplerPrePadding[ResamplerMax];
-
typedef struct ALbufferlistitem {
struct ALbuffer *buffer;
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 24e5874d..7ab17c74 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -38,21 +38,6 @@
#include "threads.h"
-enum Resampler DefaultResampler = LinearResampler;
-const ALsizei ResamplerPadding[ResamplerMax] = {
- 0, /* Point */
- 1, /* Linear */
- 2, /* FIR4 */
- 3, /* FIR6 */
-};
-const ALsizei ResamplerPrePadding[ResamplerMax] = {
- 0, /* Point */
- 0, /* Linear */
- 1, /* FIR4 */
- 2, /* FIR6 */
-};
-
-
extern inline struct ALsource *LookupSource(ALCcontext *context, ALuint id);
extern inline struct ALsource *RemoveSource(ALCcontext *context, ALuint id);