aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/alu.cpp6
-rw-r--r--Alc/mixer/defs.h12
-rw-r--r--Alc/mixer/hrtf_inc.cpp54
-rw-r--r--OpenAL32/Include/alu.h3
4 files changed, 39 insertions, 36 deletions
diff --git a/Alc/alu.cpp b/Alc/alu.cpp
index 1711d3bf..401856ac 100644
--- a/Alc/alu.cpp
+++ b/Alc/alu.cpp
@@ -135,14 +135,12 @@ void ProcessHrtf(ALCdevice *device, ALsizei SamplesToDo)
/* HRTF is stereo output only. */
const int lidx{(device->RealOut.ChannelName[0]==FrontLeft) ? 0 : 1};
- const int ridx{(device->RealOut.ChannelName[1]==FrontRight) ? 1 : 0};
+ const int ridx{(device->RealOut.ChannelName[0]==FrontLeft) ? 1 : 0};
ALfloat *LeftOut{device->RealOut.Buffer[lidx]};
ALfloat *RightOut{device->RealOut.Buffer[ridx]};
- const ALfloat (*Input)[BUFFERSIZE]{device->Dry.Buffer};
DirectHrtfState *state{device->mHrtfState.get()};
- for(ALsizei c{0};c < num_chans;c++)
- MixDirectHrtf(LeftOut, RightOut, Input[c], state, c, SamplesToDo);
+ MixDirectHrtf(LeftOut, RightOut, device->Dry.Buffer, state, num_chans, SamplesToDo);
state->Offset += SamplesToDo;
}
diff --git a/Alc/mixer/defs.h b/Alc/mixer/defs.h
index 5bdf6e30..bac93d6f 100644
--- a/Alc/mixer/defs.h
+++ b/Alc/mixer/defs.h
@@ -31,8 +31,8 @@ void MixHrtfBlend_C(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
MixHrtfParams *newparams, HrtfState *hrtfstate,
ALsizei BufferSize);
void MixDirectHrtf_C(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, DirectHrtfState *State, const ALsizei Chan,
- const ALsizei BufferSize);
+ const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State,
+ const ALsizei NumChans, const ALsizei BufferSize);
void Mix_C(const ALfloat *data, ALsizei OutChans, ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE],
ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos,
ALsizei BufferSize);
@@ -51,8 +51,8 @@ void MixHrtfBlend_SSE(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
MixHrtfParams *newparams, HrtfState *hrtfstate,
ALsizei BufferSize);
void MixDirectHrtf_SSE(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, DirectHrtfState *State, const ALsizei Chan,
- const ALsizei BufferSize);
+ const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State,
+ const ALsizei NumChans, const ALsizei BufferSize);
void Mix_SSE(const ALfloat *data, ALsizei OutChans, ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE],
ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos,
ALsizei BufferSize);
@@ -97,8 +97,8 @@ void MixHrtfBlend_Neon(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
MixHrtfParams *newparams, HrtfState *hrtfstate,
ALsizei BufferSize);
void MixDirectHrtf_Neon(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, DirectHrtfState *State, const ALsizei Chan,
- const ALsizei BufferSize);
+ const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State,
+ const ALsizei NumChans, const ALsizei BufferSize);
void Mix_Neon(const ALfloat *data, ALsizei OutChans, ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE],
ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos,
ALsizei BufferSize);
diff --git a/Alc/mixer/hrtf_inc.cpp b/Alc/mixer/hrtf_inc.cpp
index caac7e54..6c0824dc 100644
--- a/Alc/mixer/hrtf_inc.cpp
+++ b/Alc/mixer/hrtf_inc.cpp
@@ -152,40 +152,44 @@ void MixHrtfBlend(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
}
void MixDirectHrtf(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, DirectHrtfState *State, const ALsizei Chan,
- const ALsizei BufferSize)
+ const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State,
+ const ALsizei NumChans, const ALsizei BufferSize)
{
- ASSUME(Chan >= 0);
+ ASSUME(NumChans >= 0);
ASSUME(BufferSize > 0);
- const ALfloat (&Coeffs)[HRIR_LENGTH][2] = State->Chan[Chan].Coeffs;
- ALfloat (&Values)[HRIR_LENGTH][2] = State->Chan[Chan].Values;
- ALsizei Offset{State->Offset&HRIR_MASK};
const ALsizei IrSize{State->IrSize};
-
ASSUME(IrSize >= 4);
- ALsizei HeadOffset{(Offset+IrSize-1)&HRIR_MASK};
- for(ALsizei i{0};i < BufferSize;)
+ for(ALsizei c{0};c < NumChans;++c)
{
- const ALsizei todo_hrir{HRIR_LENGTH - maxi(HeadOffset, Offset)};
- const ALsizei todo{mini(BufferSize-i, todo_hrir) + i};
- ASSUME(todo > i);
+ const ALfloat (&input)[BUFFERSIZE] = data[c];
+ const ALfloat (&Coeffs)[HRIR_LENGTH][2] = State->Chan[c].Coeffs;
+ ALfloat (&Values)[HRIR_LENGTH][2] = State->Chan[c].Values;
+ ALsizei Offset{State->Offset&HRIR_MASK};
- for(;i < todo;++i)
+ ALsizei HeadOffset{(Offset+IrSize-1)&HRIR_MASK};
+ for(ALsizei i{0};i < BufferSize;)
{
- Values[HeadOffset][0] = 0.0f;
- Values[HeadOffset][1] = 0.0f;
- ++HeadOffset;
-
- const ALfloat insample{*(data++)};
- ApplyCoeffs(Offset, Values, IrSize, Coeffs, insample, insample);
-
- *(LeftOut++) += Values[Offset][0];
- *(RightOut++) += Values[Offset][1];
- ++Offset;
+ const ALsizei todo_hrir{HRIR_LENGTH - maxi(HeadOffset, Offset)};
+ const ALsizei todo{mini(BufferSize-i, todo_hrir) + i};
+ ASSUME(todo > i);
+
+ for(;i < todo;++i)
+ {
+ Values[HeadOffset][0] = 0.0f;
+ Values[HeadOffset][1] = 0.0f;
+ ++HeadOffset;
+
+ const ALfloat insample{input[i]};
+ ApplyCoeffs(Offset, Values, IrSize, Coeffs, insample, insample);
+
+ LeftOut[i] += Values[Offset][0];
+ RightOut[i] += Values[Offset][1];
+ ++Offset;
+ }
+ HeadOffset &= HRIR_MASK;
+ Offset &= HRIR_MASK;
}
- HeadOffset &= HRIR_MASK;
- Offset &= HRIR_MASK;
}
}
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index f575ba52..b004fbf8 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -287,7 +287,8 @@ using HrtfMixerBlendFunc = void(*)(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT
const HrtfParams *oldparams, MixHrtfParams *newparams, HrtfState *hrtfstate,
const ALsizei BufferSize);
using HrtfDirectMixerFunc = void(*)(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, DirectHrtfState *State, const ALsizei Chan, const ALsizei BufferSize);
+ const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State, const ALsizei NumChans,
+ const ALsizei BufferSize);
#define GAIN_MIX_MAX (1000.0f) /* +60dB */