Put the HRTF DirectParams into an anonymous struct
This commit is contained in:
parent
a14383d6cc
commit
4f5aafe59f
52
Alc/ALu.c
52
Alc/ALu.c
@ -365,12 +365,12 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
|
||||
if(chans[c].channel == LFE)
|
||||
{
|
||||
/* Skip LFE */
|
||||
ALSource->Params.Direct.Hrtf.Delay[c][0] = 0;
|
||||
ALSource->Params.Direct.Hrtf.Delay[c][1] = 0;
|
||||
ALSource->Params.Direct.Hrtf.Params.Delay[c][0] = 0;
|
||||
ALSource->Params.Direct.Hrtf.Params.Delay[c][1] = 0;
|
||||
for(i = 0;i < HRIR_LENGTH;i++)
|
||||
{
|
||||
ALSource->Params.Direct.Hrtf.Coeffs[c][i][0] = 0.0f;
|
||||
ALSource->Params.Direct.Hrtf.Coeffs[c][i][1] = 0.0f;
|
||||
ALSource->Params.Direct.Hrtf.Params.Coeffs[c][i][0] = 0.0f;
|
||||
ALSource->Params.Direct.Hrtf.Params.Coeffs[c][i][1] = 0.0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -379,14 +379,14 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
|
||||
* channel. */
|
||||
GetLerpedHrtfCoeffs(Device->Hrtf,
|
||||
0.0f, chans[c].angle, DryGain,
|
||||
ALSource->Params.Direct.Hrtf.Coeffs[c],
|
||||
ALSource->Params.Direct.Hrtf.Delay[c]);
|
||||
ALSource->Params.Direct.Hrtf.Params.Coeffs[c],
|
||||
ALSource->Params.Direct.Hrtf.Params.Delay[c]);
|
||||
}
|
||||
}
|
||||
ALSource->Hrtf.Counter = 0;
|
||||
ALSource->Params.Direct.Hrtf.IrSize = GetHrtfIrSize(Device->Hrtf);
|
||||
ALSource->Params.Direct.Hrtf.Params.IrSize = GetHrtfIrSize(Device->Hrtf);
|
||||
|
||||
ALSource->Params.Direct.hrtfState = &ALSource->Hrtf;
|
||||
ALSource->Params.Direct.Hrtf.State = &ALSource->Hrtf;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -794,8 +794,8 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
|
||||
if(ALSource->Hrtf.Moving)
|
||||
{
|
||||
/* Calculate the normalized HRTF transition factor (delta). */
|
||||
delta = CalcHrtfDelta(ALSource->Params.Direct.Hrtf.Gain, DryGain,
|
||||
ALSource->Params.Direct.Hrtf.Dir, Position);
|
||||
delta = CalcHrtfDelta(ALSource->Params.Direct.Hrtf.Params.Gain, DryGain,
|
||||
ALSource->Params.Direct.Hrtf.Params.Dir, Position);
|
||||
/* If the delta is large enough, get the moving HRIR target
|
||||
* coefficients, target delays, steppping values, and counter. */
|
||||
if(delta > 0.001f)
|
||||
@ -803,32 +803,32 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
|
||||
ALSource->Hrtf.Counter = GetMovingHrtfCoeffs(Device->Hrtf,
|
||||
ev, az, DryGain, delta,
|
||||
ALSource->Hrtf.Counter,
|
||||
ALSource->Params.Direct.Hrtf.Coeffs[0],
|
||||
ALSource->Params.Direct.Hrtf.Delay[0],
|
||||
ALSource->Params.Direct.Hrtf.CoeffStep,
|
||||
ALSource->Params.Direct.Hrtf.DelayStep);
|
||||
ALSource->Params.Direct.Hrtf.Gain = DryGain;
|
||||
ALSource->Params.Direct.Hrtf.Dir[0] = Position[0];
|
||||
ALSource->Params.Direct.Hrtf.Dir[1] = Position[1];
|
||||
ALSource->Params.Direct.Hrtf.Dir[2] = Position[2];
|
||||
ALSource->Params.Direct.Hrtf.Params.Coeffs[0],
|
||||
ALSource->Params.Direct.Hrtf.Params.Delay[0],
|
||||
ALSource->Params.Direct.Hrtf.Params.CoeffStep,
|
||||
ALSource->Params.Direct.Hrtf.Params.DelayStep);
|
||||
ALSource->Params.Direct.Hrtf.Params.Gain = DryGain;
|
||||
ALSource->Params.Direct.Hrtf.Params.Dir[0] = Position[0];
|
||||
ALSource->Params.Direct.Hrtf.Params.Dir[1] = Position[1];
|
||||
ALSource->Params.Direct.Hrtf.Params.Dir[2] = Position[2];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Get the initial (static) HRIR coefficients and delays. */
|
||||
GetLerpedHrtfCoeffs(Device->Hrtf, ev, az, DryGain,
|
||||
ALSource->Params.Direct.Hrtf.Coeffs[0],
|
||||
ALSource->Params.Direct.Hrtf.Delay[0]);
|
||||
ALSource->Params.Direct.Hrtf.Params.Coeffs[0],
|
||||
ALSource->Params.Direct.Hrtf.Params.Delay[0]);
|
||||
ALSource->Hrtf.Counter = 0;
|
||||
ALSource->Hrtf.Moving = AL_TRUE;
|
||||
ALSource->Params.Direct.Hrtf.Gain = DryGain;
|
||||
ALSource->Params.Direct.Hrtf.Dir[0] = Position[0];
|
||||
ALSource->Params.Direct.Hrtf.Dir[1] = Position[1];
|
||||
ALSource->Params.Direct.Hrtf.Dir[2] = Position[2];
|
||||
ALSource->Params.Direct.Hrtf.Params.Gain = DryGain;
|
||||
ALSource->Params.Direct.Hrtf.Params.Dir[0] = Position[0];
|
||||
ALSource->Params.Direct.Hrtf.Params.Dir[1] = Position[1];
|
||||
ALSource->Params.Direct.Hrtf.Params.Dir[2] = Position[2];
|
||||
}
|
||||
ALSource->Params.Direct.Hrtf.IrSize = GetHrtfIrSize(Device->Hrtf);
|
||||
ALSource->Params.Direct.Hrtf.Params.IrSize = GetHrtfIrSize(Device->Hrtf);
|
||||
|
||||
ALSource->Params.Direct.hrtfState = &ALSource->Hrtf;
|
||||
ALSource->Params.Direct.Hrtf.State = &ALSource->Hrtf;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -35,15 +35,15 @@ void MixDirect_Hrtf(const DirectParams *params, const ALfloat *RESTRICT data, AL
|
||||
ALfloat (*RESTRICT DryBuffer)[BUFFERSIZE] = params->OutBuffer;
|
||||
ALfloat *RESTRICT ClickRemoval = params->ClickRemoval;
|
||||
ALfloat *RESTRICT PendingClicks = params->PendingClicks;
|
||||
const ALuint IrSize = params->Hrtf.IrSize;
|
||||
const ALint *RESTRICT DelayStep = params->Hrtf.DelayStep;
|
||||
const ALfloat (*RESTRICT CoeffStep)[2] = params->Hrtf.CoeffStep;
|
||||
const ALfloat (*RESTRICT TargetCoeffs)[2] = params->Hrtf.Coeffs[srcchan];
|
||||
const ALuint *RESTRICT TargetDelay = params->Hrtf.Delay[srcchan];
|
||||
ALfloat *RESTRICT History = params->hrtfState->History[srcchan];
|
||||
ALfloat (*RESTRICT Values)[2] = params->hrtfState->Values[srcchan];
|
||||
ALint Counter = maxu(params->hrtfState->Counter, OutPos) - OutPos;
|
||||
ALuint Offset = params->hrtfState->Offset + OutPos;
|
||||
const ALuint IrSize = params->Hrtf.Params.IrSize;
|
||||
const ALint *RESTRICT DelayStep = params->Hrtf.Params.DelayStep;
|
||||
const ALfloat (*RESTRICT CoeffStep)[2] = params->Hrtf.Params.CoeffStep;
|
||||
const ALfloat (*RESTRICT TargetCoeffs)[2] = params->Hrtf.Params.Coeffs[srcchan];
|
||||
const ALuint *RESTRICT TargetDelay = params->Hrtf.Params.Delay[srcchan];
|
||||
ALfloat *RESTRICT History = params->Hrtf.State->History[srcchan];
|
||||
ALfloat (*RESTRICT Values)[2] = params->Hrtf.State->Values[srcchan];
|
||||
ALint Counter = maxu(params->Hrtf.State->Counter, OutPos) - OutPos;
|
||||
ALuint Offset = params->Hrtf.State->Offset + OutPos;
|
||||
ALIGN(16) ALfloat Coeffs[HRIR_LENGTH][2];
|
||||
ALuint Delay[2];
|
||||
ALfloat left, right;
|
||||
|
@ -51,8 +51,10 @@ typedef struct DirectParams {
|
||||
ALfloat *ClickRemoval;
|
||||
ALfloat *PendingClicks;
|
||||
|
||||
HrtfParams Hrtf;
|
||||
HrtfState *hrtfState;
|
||||
struct {
|
||||
HrtfParams Params;
|
||||
HrtfState *State;
|
||||
} Hrtf;
|
||||
|
||||
/* A mixing matrix. First subscript is the channel number of the input data
|
||||
* (regardless of channel configuration) and the second is the channel
|
||||
|
Loading…
Reference in New Issue
Block a user