aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-12-31 23:33:04 -0800
committerChris Robinson <[email protected]>2018-12-31 23:33:04 -0800
commita9e71c2668e7c49d089623633bd92bcfc3fe1465 (patch)
tree277f7be4c4f0bc35210eaa674dbdeb03debb2492 /Alc/mixer
parent0452c9201d993209d1138a1cae7a538f5b0ceb42 (diff)
Handle all input channels in MixDirectHrtf
Diffstat (limited to 'Alc/mixer')
-rw-r--r--Alc/mixer/defs.h12
-rw-r--r--Alc/mixer/hrtf_inc.cpp54
2 files changed, 35 insertions, 31 deletions
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;
}
}