aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer_c.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-11-23 10:49:54 -0800
committerChris Robinson <[email protected]>2014-11-23 10:49:54 -0800
commit45d6bb58a4293c5b1ab229cea86e0ef24a2a084b (patch)
treeec03ad6eac812ae209f8d973687afa5b99616133 /Alc/mixer_c.c
parentfc3608b381c0492674b4cfc1da0dcf5389ace722 (diff)
Partially revert "Use a different method for HRTF mixing"
The sound localization with virtual channel mixing was just too poor, so while it's more costly to do per-source HRTF mixing, it's unavoidable if you want good localization. This is only partially reverted because having the virtual channel is still beneficial, particularly with B-Format rendering and effect mixing which otherwise skip HRTF processing. As before, the number of virtual channels can potentially be customized, specifying more or less channels depending on the system's needs.
Diffstat (limited to 'Alc/mixer_c.c')
-rw-r--r--Alc/mixer_c.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c
index caedd339..0fdcc087 100644
--- a/Alc/mixer_c.c
+++ b/Alc/mixer_c.c
@@ -59,6 +59,23 @@ void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const
}
+static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2],
+ const ALuint IrSize,
+ ALfloat (*restrict Coeffs)[2],
+ const ALfloat (*restrict CoeffStep)[2],
+ ALfloat left, ALfloat right)
+{
+ ALuint c;
+ for(c = 0;c < IrSize;c++)
+ {
+ const ALuint off = (Offset+c)&HRIR_MASK;
+ Values[off][0] += Coeffs[c][0] * left;
+ Values[off][1] += Coeffs[c][1] * right;
+ Coeffs[c][0] += CoeffStep[c][0];
+ Coeffs[c][1] += CoeffStep[c][1];
+ }
+}
+
static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2],
const ALuint IrSize,
ALfloat (*restrict Coeffs)[2],