diff options
author | Chris Robinson <[email protected]> | 2016-08-12 05:26:36 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-08-12 05:26:36 -0700 |
commit | 770e2ff7ed516a41721d6cde931b3cefc07c190e (patch) | |
tree | ce6d59d89039aba7339575e5bb0783032289e401 /Alc/mixer_inc.c | |
parent | c6c6e3324dd9d5d864b6146ca7a6c6e6369978a6 (diff) |
Use a more specialized mixer function for B-Format to HRTF
Diffstat (limited to 'Alc/mixer_inc.c')
-rw-r--r-- | Alc/mixer_inc.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Alc/mixer_inc.c b/Alc/mixer_inc.c index e9d81c2a..25dc2b58 100644 --- a/Alc/mixer_inc.c +++ b/Alc/mixer_inc.c @@ -114,3 +114,36 @@ skip_stepping: OutPos += todo; } } + +void MixDirectHrtf(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, + const ALfloat *data, ALuint Offset, const ALuint IrSize, + ALfloat (*restrict Coeffs)[2], ALfloat (*restrict Values)[2], + ALuint BufferSize) +{ + ALfloat out[MAX_UPDATE_SAMPLES][2]; + ALfloat insample; + ALuint pos, i; + + for(pos = 0;pos < BufferSize;) + { + ALuint todo = minu(BufferSize-pos, MAX_UPDATE_SAMPLES); + + for(i = 0;i < todo;i++) + { + Values[(Offset+IrSize)&HRIR_MASK][0] = 0.0f; + Values[(Offset+IrSize)&HRIR_MASK][1] = 0.0f; + Offset++; + + insample = *(data++); + ApplyCoeffs(Offset, Values, IrSize, Coeffs, insample, insample); + out[i][0] = Values[Offset&HRIR_MASK][0]; + out[i][1] = Values[Offset&HRIR_MASK][1]; + } + + for(i = 0;i < todo;i++) + OutBuffer[lidx][pos+i] += out[i][0]; + for(i = 0;i < todo;i++) + OutBuffer[ridx][pos+i] += out[i][1]; + pos += todo; + } +} |