aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c48
-rw-r--r--Alc/mixer_inc.c59
2 files changed, 51 insertions, 56 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 4bff7525..25d2db42 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -473,12 +473,12 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALCcontext *ALContext)
if(chans[c].channel == LFE)
{
/* Skip LFE */
- src->Direct.Mix.Hrtf.Params.Delay[c][0] = 0;
- src->Direct.Mix.Hrtf.Params.Delay[c][1] = 0;
+ src->Direct.Mix.Hrtf.Params[c].Delay[0] = 0;
+ src->Direct.Mix.Hrtf.Params[c].Delay[1] = 0;
for(i = 0;i < HRIR_LENGTH;i++)
{
- src->Direct.Mix.Hrtf.Params.Coeffs[c][i][0] = 0.0f;
- src->Direct.Mix.Hrtf.Params.Coeffs[c][i][1] = 0.0f;
+ src->Direct.Mix.Hrtf.Params[c].Coeffs[i][0] = 0.0f;
+ src->Direct.Mix.Hrtf.Params[c].Coeffs[i][1] = 0.0f;
}
}
else
@@ -487,13 +487,13 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALCcontext *ALContext)
* channel. */
GetLerpedHrtfCoeffs(Device->Hrtf,
0.0f, chans[c].angle, DryGain,
- src->Direct.Mix.Hrtf.Params.Coeffs[c],
- src->Direct.Mix.Hrtf.Params.Delay[c]);
+ src->Direct.Mix.Hrtf.Params[c].Coeffs,
+ src->Direct.Mix.Hrtf.Params[c].Delay);
}
}
src->Direct.Counter = 0;
src->Direct.Moving = AL_TRUE;
- src->Direct.Mix.Hrtf.Params.IrSize = GetHrtfIrSize(Device->Hrtf);
+ src->Direct.Mix.Hrtf.IrSize = GetHrtfIrSize(Device->Hrtf);
src->DryMix = SelectHrtfMixer();
}
@@ -948,8 +948,8 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALCcontext *ALContext)
if(src->Direct.Moving)
{
/* Calculate the normalized HRTF transition factor (delta). */
- delta = CalcHrtfDelta(src->Direct.Mix.Hrtf.Params.Gain, DryGain,
- src->Direct.Mix.Hrtf.Params.Dir, Position);
+ delta = CalcHrtfDelta(src->Direct.Mix.Hrtf.Gain, DryGain,
+ src->Direct.Mix.Hrtf.Dir, Position);
/* If the delta is large enough, get the moving HRIR target
* coefficients, target delays, steppping values, and counter. */
if(delta > 0.001f)
@@ -957,31 +957,31 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALCcontext *ALContext)
ALuint counter = GetMovingHrtfCoeffs(Device->Hrtf,
ev, az, DryGain, delta,
src->Direct.Counter,
- src->Direct.Mix.Hrtf.Params.Coeffs[0],
- src->Direct.Mix.Hrtf.Params.Delay[0],
- src->Direct.Mix.Hrtf.Params.CoeffStep[0],
- src->Direct.Mix.Hrtf.Params.DelayStep[0]);
+ src->Direct.Mix.Hrtf.Params[0].Coeffs,
+ src->Direct.Mix.Hrtf.Params[0].Delay,
+ src->Direct.Mix.Hrtf.Params[0].CoeffStep,
+ src->Direct.Mix.Hrtf.Params[0].DelayStep);
src->Direct.Counter = counter;
- src->Direct.Mix.Hrtf.Params.Gain = DryGain;
- src->Direct.Mix.Hrtf.Params.Dir[0] = Position[0];
- src->Direct.Mix.Hrtf.Params.Dir[1] = Position[1];
- src->Direct.Mix.Hrtf.Params.Dir[2] = Position[2];
+ src->Direct.Mix.Hrtf.Gain = DryGain;
+ src->Direct.Mix.Hrtf.Dir[0] = Position[0];
+ src->Direct.Mix.Hrtf.Dir[1] = Position[1];
+ src->Direct.Mix.Hrtf.Dir[2] = Position[2];
}
}
else
{
/* Get the initial (static) HRIR coefficients and delays. */
GetLerpedHrtfCoeffs(Device->Hrtf, ev, az, DryGain,
- src->Direct.Mix.Hrtf.Params.Coeffs[0],
- src->Direct.Mix.Hrtf.Params.Delay[0]);
+ src->Direct.Mix.Hrtf.Params[0].Coeffs,
+ src->Direct.Mix.Hrtf.Params[0].Delay);
src->Direct.Counter = 0;
src->Direct.Moving = AL_TRUE;
- src->Direct.Mix.Hrtf.Params.Gain = DryGain;
- src->Direct.Mix.Hrtf.Params.Dir[0] = Position[0];
- src->Direct.Mix.Hrtf.Params.Dir[1] = Position[1];
- src->Direct.Mix.Hrtf.Params.Dir[2] = Position[2];
+ src->Direct.Mix.Hrtf.Gain = DryGain;
+ src->Direct.Mix.Hrtf.Dir[0] = Position[0];
+ src->Direct.Mix.Hrtf.Dir[1] = Position[1];
+ src->Direct.Mix.Hrtf.Dir[2] = Position[2];
}
- src->Direct.Mix.Hrtf.Params.IrSize = GetHrtfIrSize(Device->Hrtf);
+ src->Direct.Mix.Hrtf.IrSize = GetHrtfIrSize(Device->Hrtf);
src->DryMix = SelectHrtfMixer();
}
diff --git a/Alc/mixer_inc.c b/Alc/mixer_inc.c
index 4748f785..e9288b29 100644
--- a/Alc/mixer_inc.c
+++ b/Alc/mixer_inc.c
@@ -29,13 +29,9 @@ void MixDirect_Hrtf(DirectParams *params, const ALfloat *restrict data, ALuint s
ALuint OutPos, ALuint BufferSize)
{
ALfloat (*restrict DryBuffer)[BUFFERSIZE] = params->OutBuffer;
- const ALuint IrSize = params->Mix.Hrtf.Params.IrSize;
- const ALint *restrict DelayStep = params->Mix.Hrtf.Params.DelayStep[srcchan];
- const ALfloat (*restrict CoeffStep)[2] = params->Mix.Hrtf.Params.CoeffStep[srcchan];
- const ALfloat (*restrict TargetCoeffs)[2] = params->Mix.Hrtf.Params.Coeffs[srcchan];
- const ALuint *restrict TargetDelay = params->Mix.Hrtf.Params.Delay[srcchan];
- ALfloat *restrict History = params->Mix.Hrtf.State.History[srcchan];
- ALfloat (*restrict Values)[2] = params->Mix.Hrtf.State.Values[srcchan];
+ const ALuint IrSize = params->Mix.Hrtf.IrSize;
+ const HrtfParams *hrtfparams = &params->Mix.Hrtf.Params[srcchan];
+ HrtfState *hrtfstate = &params->Mix.Hrtf.State[srcchan];
ALuint Counter = maxu(params->Counter, OutPos) - OutPos;
ALuint Offset = params->Offset + OutPos;
alignas(16) ALfloat Coeffs[HRIR_LENGTH][2];
@@ -47,33 +43,32 @@ void MixDirect_Hrtf(DirectParams *params, const ALfloat *restrict data, ALuint s
pos = 0;
for(c = 0;c < IrSize;c++)
{
- Coeffs[c][0] = TargetCoeffs[c][0] - (CoeffStep[c][0]*Counter);
- Coeffs[c][1] = TargetCoeffs[c][1] - (CoeffStep[c][1]*Counter);
+ Coeffs[c][0] = hrtfparams->Coeffs[c][0] - (hrtfparams->CoeffStep[c][0]*Counter);
+ Coeffs[c][1] = hrtfparams->Coeffs[c][1] - (hrtfparams->CoeffStep[c][1]*Counter);
}
-
- Delay[0] = TargetDelay[0] - (DelayStep[0]*Counter);
- Delay[1] = TargetDelay[1] - (DelayStep[1]*Counter);
+ Delay[0] = hrtfparams->Delay[0] - (hrtfparams->DelayStep[0]*Counter);
+ Delay[1] = hrtfparams->Delay[1] - (hrtfparams->DelayStep[1]*Counter);
for(pos = 0;pos < BufferSize && pos < Counter;pos++)
{
- History[Offset&SRC_HISTORY_MASK] = data[pos];
- left = lerp(History[(Offset-(Delay[0]>>HRTFDELAY_BITS))&SRC_HISTORY_MASK],
- History[(Offset-(Delay[0]>>HRTFDELAY_BITS)-1)&SRC_HISTORY_MASK],
+ hrtfstate->History[Offset&SRC_HISTORY_MASK] = data[pos];
+ left = lerp(hrtfstate->History[(Offset-(Delay[0]>>HRTFDELAY_BITS))&SRC_HISTORY_MASK],
+ hrtfstate->History[(Offset-(Delay[0]>>HRTFDELAY_BITS)-1)&SRC_HISTORY_MASK],
(Delay[0]&HRTFDELAY_MASK)*(1.0f/HRTFDELAY_FRACONE));
- right = lerp(History[(Offset-(Delay[1]>>HRTFDELAY_BITS))&SRC_HISTORY_MASK],
- History[(Offset-(Delay[1]>>HRTFDELAY_BITS)-1)&SRC_HISTORY_MASK],
+ right = lerp(hrtfstate->History[(Offset-(Delay[1]>>HRTFDELAY_BITS))&SRC_HISTORY_MASK],
+ hrtfstate->History[(Offset-(Delay[1]>>HRTFDELAY_BITS)-1)&SRC_HISTORY_MASK],
(Delay[1]&HRTFDELAY_MASK)*(1.0f/HRTFDELAY_FRACONE));
- Delay[0] += DelayStep[0];
- Delay[1] += DelayStep[1];
+ Delay[0] += hrtfparams->DelayStep[0];
+ Delay[1] += hrtfparams->DelayStep[1];
- Values[(Offset+IrSize)&HRIR_MASK][0] = 0.0f;
- Values[(Offset+IrSize)&HRIR_MASK][1] = 0.0f;
+ hrtfstate->Values[(Offset+IrSize)&HRIR_MASK][0] = 0.0f;
+ hrtfstate->Values[(Offset+IrSize)&HRIR_MASK][1] = 0.0f;
Offset++;
- ApplyCoeffsStep(Offset, Values, IrSize, Coeffs, CoeffStep, left, right);
- DryBuffer[FrontLeft][OutPos] += Values[Offset&HRIR_MASK][0];
- DryBuffer[FrontRight][OutPos] += Values[Offset&HRIR_MASK][1];
+ ApplyCoeffsStep(Offset, hrtfstate->Values, IrSize, Coeffs, hrtfparams->CoeffStep, left, right);
+ DryBuffer[FrontLeft][OutPos] += hrtfstate->Values[Offset&HRIR_MASK][0];
+ DryBuffer[FrontRight][OutPos] += hrtfstate->Values[Offset&HRIR_MASK][1];
OutPos++;
}
@@ -81,17 +76,17 @@ void MixDirect_Hrtf(DirectParams *params, const ALfloat *restrict data, ALuint s
Delay[1] >>= HRTFDELAY_BITS;
for(;pos < BufferSize;pos++)
{
- History[Offset&SRC_HISTORY_MASK] = data[pos];
- left = History[(Offset-Delay[0])&SRC_HISTORY_MASK];
- right = History[(Offset-Delay[1])&SRC_HISTORY_MASK];
+ hrtfstate->History[Offset&SRC_HISTORY_MASK] = data[pos];
+ left = hrtfstate->History[(Offset-Delay[0])&SRC_HISTORY_MASK];
+ right = hrtfstate->History[(Offset-Delay[1])&SRC_HISTORY_MASK];
- Values[(Offset+IrSize)&HRIR_MASK][0] = 0.0f;
- Values[(Offset+IrSize)&HRIR_MASK][1] = 0.0f;
+ hrtfstate->Values[(Offset+IrSize)&HRIR_MASK][0] = 0.0f;
+ hrtfstate->Values[(Offset+IrSize)&HRIR_MASK][1] = 0.0f;
Offset++;
- ApplyCoeffs(Offset, Values, IrSize, Coeffs, left, right);
- DryBuffer[FrontLeft][OutPos] += Values[Offset&HRIR_MASK][0];
- DryBuffer[FrontRight][OutPos] += Values[Offset&HRIR_MASK][1];
+ ApplyCoeffs(Offset, hrtfstate->Values, IrSize, Coeffs, left, right);
+ DryBuffer[FrontLeft][OutPos] += hrtfstate->Values[Offset&HRIR_MASK][0];
+ DryBuffer[FrontRight][OutPos] += hrtfstate->Values[Offset&HRIR_MASK][1];
OutPos++;
}