aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-08-07 01:38:26 -0700
committerChris Robinson <[email protected]>2017-08-07 01:38:26 -0700
commit530002e168c907bd3468cd0fefaec2565e248bbd (patch)
tree81277088117c0489cc405c17ee6fc0576b705891 /Alc
parent6eadccc99d518912addf73b2b39b5cbdcbb2b086 (diff)
Avoid re-selecting the direct HRTF mix function
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c1
-rw-r--r--Alc/ALu.c37
2 files changed, 23 insertions, 15 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index b367dd1d..a1c17087 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1001,6 +1001,7 @@ static void alc_initconfig(void)
#endif
ConfigValueInt(NULL, NULL, "rt-prio", &RTPrioLevel);
+ aluInit();
aluInitMixer();
str = getenv("ALSOFT_TRAP_ERROR");
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 5230d4c6..8055ac91 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -43,18 +43,6 @@
#include "backends/base.h"
-struct ChanMap {
- enum Channel channel;
- ALfloat angle;
- ALfloat elevation;
-};
-
-/* Cone scalar */
-ALfloat ConeScale = 1.0f;
-
-/* Localized Z scalar for mono sources */
-ALfloat ZScale = 1.0f;
-
extern inline ALfloat minf(ALfloat a, ALfloat b);
extern inline ALfloat maxf(ALfloat a, ALfloat b);
extern inline ALfloat clampf(ALfloat val, ALfloat min, ALfloat max);
@@ -92,6 +80,13 @@ extern inline void aluMatrixfSet(aluMatrixf *matrix,
ALfloat m20, ALfloat m21, ALfloat m22, ALfloat m23,
ALfloat m30, ALfloat m31, ALfloat m32, ALfloat m33);
+
+/* Cone scalar */
+ALfloat ConeScale = 1.0f;
+
+/* Localized Z scalar for mono sources */
+ALfloat ZScale = 1.0f;
+
const aluMatrixf IdentityMatrixf = {{
{ 1.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 1.0f, 0.0f, 0.0f },
@@ -100,6 +95,15 @@ const aluMatrixf IdentityMatrixf = {{
}};
+struct ChanMap {
+ enum Channel channel;
+ ALfloat angle;
+ ALfloat elevation;
+};
+
+static HrtfDirectMixerFunc MixDirectHrtf = MixDirectHrtf_C;
+
+
void DeinitVoice(ALvoice *voice)
{
struct ALvoiceProps *props;
@@ -206,6 +210,11 @@ static aluVector aluMatrixfVector(const aluMatrixf *mtx, const aluVector *vec)
}
+void aluInit(void)
+{
+ MixDirectHrtf = SelectHrtfMixer();
+}
+
/* Prepares the interpolator for a given rate (determined by increment). A
* result of AL_FALSE indicates that the filter output will completely cut
* the input signal.
@@ -1729,7 +1738,6 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples)
if(device->HrtfHandle)
{
- HrtfDirectMixerFunc HrtfMix;
DirectHrtfState *state;
int lidx, ridx;
@@ -1743,11 +1751,10 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples)
ridx = GetChannelIdxByName(device->RealOut, FrontRight);
assert(lidx != -1 && ridx != -1);
- HrtfMix = SelectHrtfMixer();
state = device->Hrtf;
for(c = 0;c < device->Dry.NumChannels;c++)
{
- HrtfMix(device->RealOut.Buffer[lidx], device->RealOut.Buffer[ridx],
+ MixDirectHrtf(device->RealOut.Buffer[lidx], device->RealOut.Buffer[ridx],
device->Dry.Buffer[c], state->Offset, state->IrSize,
SAFE_CONST(ALfloat2*,state->Chan[c].Coeffs),
state->Chan[c].Values, SamplesToDo