aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-03-12 06:58:27 -0700
committerChris Robinson <[email protected]>2017-03-12 06:58:27 -0700
commit7b4645f5f8d0269f47517a506297bfb7694ec990 (patch)
treebfa97603c7c0fbc7dc4914a6c8d8a2b200a21341 /Alc
parent96aaab93662be289d3b2c5312ae50502afa8d221 (diff)
Store the HRIR coeff pointer and delays directly in MixHrtfParams
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c1
-rw-r--r--Alc/mixer.c14
-rw-r--r--Alc/mixer_inc.c4
3 files changed, 12 insertions, 7 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 55f0c09a..5148d141 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1504,7 +1504,6 @@ void aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
state = device->Hrtf;
for(c = 0;c < device->Dry.NumChannels;c++)
{
- typedef ALfloat ALfloat2[2];
HrtfMix(device->RealOut.Buffer[lidx], device->RealOut.Buffer[ridx],
device->Dry.Buffer[c], state->Offset, state->IrSize,
SAFE_CONST(ALfloat2*,state->Chan[c].Coeffs),
diff --git a/Alc/mixer.c b/Alc/mixer.c
index 67e74396..fd2eba01 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -612,7 +612,9 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
if(!Counter)
{
parms->Hrtf.Old = parms->Hrtf.Target;
- hrtfparams.Current = &parms->Hrtf.Target;
+ hrtfparams.Coeffs = SAFE_CONST(ALfloat2*,parms->Hrtf.Target.Coeffs);
+ hrtfparams.Delay[0] = parms->Hrtf.Target.Delay[0];
+ hrtfparams.Delay[1] = parms->Hrtf.Target.Delay[1];
hrtfparams.Gain = parms->Hrtf.Target.Gain;
hrtfparams.GainStep = 0.0f;
MixHrtfSamples(
@@ -631,7 +633,9 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
* So it needs to fade out over DstBufferSize instead
* of Counter.
*/
- hrtfparams.Current = &parms->Hrtf.Old;
+ hrtfparams.Coeffs = SAFE_CONST(ALfloat2*,parms->Hrtf.Old.Coeffs);
+ hrtfparams.Delay[0] = parms->Hrtf.Old.Delay[0];
+ hrtfparams.Delay[1] = parms->Hrtf.Old.Delay[1];
hrtfparams.Gain = parms->Hrtf.Old.Gain;
hrtfparams.GainStep = -hrtfparams.Gain /
(ALfloat)DstBufferSize;
@@ -648,8 +652,10 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
* fade time this mix handles.
*/
gain = lerp(parms->Hrtf.Old.Gain, parms->Hrtf.Target.Gain,
- minf(1.0f, (ALfloat)Counter / (ALfloat)DstBufferSize));
- hrtfparams.Current = &parms->Hrtf.Target;
+ minf(1.0f, (ALfloat)Counter/DstBufferSize));
+ hrtfparams.Coeffs = SAFE_CONST(ALfloat2*,parms->Hrtf.Target.Coeffs);
+ hrtfparams.Delay[0] = parms->Hrtf.Target.Delay[0];
+ hrtfparams.Delay[1] = parms->Hrtf.Target.Delay[1];
hrtfparams.Gain = 0.0f;
hrtfparams.GainStep = gain / (ALfloat)DstBufferSize;
MixHrtfSamples(
diff --git a/Alc/mixer_inc.c b/Alc/mixer_inc.c
index b42b0fd3..ee3286e9 100644
--- a/Alc/mixer_inc.c
+++ b/Alc/mixer_inc.c
@@ -23,8 +23,8 @@ void MixHrtf(ALfloat *restrict LeftOut, ALfloat *restrict RightOut,
const ALsizei IrSize, MixHrtfParams *hrtfparams, HrtfState *hrtfstate,
ALsizei BufferSize)
{
- const ALfloat (*Coeffs)[2] = hrtfparams->Current->Coeffs;
- ALsizei Delay[2] = { hrtfparams->Current->Delay[0], hrtfparams->Current->Delay[1] };
+ const ALfloat (*Coeffs)[2] = ASSUME_ALIGNED(hrtfparams->Coeffs, 16);
+ const ALsizei Delay[2] = { hrtfparams->Delay[0], hrtfparams->Delay[1] };
ALfloat gainstep = hrtfparams->GainStep;
ALfloat gain = hrtfparams->Gain;
ALfloat left, right;