aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer/hrtf_inc.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-01-23 12:23:05 -0800
committerChris Robinson <[email protected]>2019-01-23 12:23:05 -0800
commit8429770c3f4f6ab4bd21d5af518de58d6af3af57 (patch)
tree02a77ef595b71f571b718755e0a57e60af4ce2d4 /Alc/mixer/hrtf_inc.cpp
parentd3842a632da8542ac0c8fbdff39dc3d4a25c1a16 (diff)
Use template declarations for the HRTF mixers
Diffstat (limited to 'Alc/mixer/hrtf_inc.cpp')
-rw-r--r--Alc/mixer/hrtf_inc.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/Alc/mixer/hrtf_inc.cpp b/Alc/mixer/hrtf_inc.cpp
index 594c6119..97065392 100644
--- a/Alc/mixer/hrtf_inc.cpp
+++ b/Alc/mixer/hrtf_inc.cpp
@@ -8,15 +8,15 @@
#include "defs.h"
-static inline void ApplyCoeffs(ALsizei Offset, ALfloat (&Values)[HRIR_LENGTH][2],
- const ALsizei irSize, const ALfloat (&Coeffs)[HRIR_LENGTH][2],
- const ALfloat left, const ALfloat right);
+using ApplyCoeffsT = void(ALsizei Offset, ALfloat (&Values)[HRIR_LENGTH][2],
+ const ALsizei irSize, const ALfloat (&Coeffs)[HRIR_LENGTH][2],
+ const ALfloat left, const ALfloat right);
-void MixHrtf(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, ALsizei Offset, const ALsizei OutPos,
- const ALsizei IrSize, MixHrtfParams *hrtfparams, HrtfState *hrtfstate,
- const ALsizei BufferSize)
+template<ApplyCoeffsT ApplyCoeffs>
+inline void MixHrtfBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data,
+ ALsizei Offset, const ALsizei OutPos, const ALsizei IrSize, MixHrtfParams *hrtfparams,
+ HrtfState *hrtfstate, const ALsizei BufferSize)
{
ASSUME(OutPos >= 0);
ASSUME(IrSize >= 4);
@@ -76,11 +76,11 @@ void MixHrtf(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
hrtfparams->Gain = gain + gainstep*stepcount;
}
-void MixHrtfBlend(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, ALsizei Offset, const ALsizei OutPos,
- const ALsizei IrSize, const HrtfParams *oldparams,
- MixHrtfParams *newparams, HrtfState *hrtfstate,
- const ALsizei BufferSize)
+template<ApplyCoeffsT ApplyCoeffs>
+inline void MixHrtfBlendBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
+ const ALfloat *data, ALsizei Offset, const ALsizei OutPos, const ALsizei IrSize,
+ const HrtfParams *oldparams, MixHrtfParams *newparams, HrtfState *hrtfstate,
+ const ALsizei BufferSize)
{
const ALfloat (&OldCoeffs)[HRIR_LENGTH][2] = oldparams->Coeffs;
const ALfloat oldGain{oldparams->Gain};
@@ -151,9 +151,10 @@ void MixHrtfBlend(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
newparams->Gain = newGainStep*stepcount;
}
-void MixDirectHrtf(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State,
- const ALsizei NumChans, const ALsizei BufferSize)
+template<ApplyCoeffsT ApplyCoeffs>
+inline void MixDirectHrtfBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
+ const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State, const ALsizei NumChans,
+ const ALsizei BufferSize)
{
ASSUME(NumChans > 0);
ASSUME(BufferSize > 0);