aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-10-15 01:37:37 -0700
committerChris Robinson <[email protected]>2012-10-15 01:37:37 -0700
commit4f5aafe59f936084d60f782122ca59db3d51dae0 (patch)
tree4f46378449241033d67df51e7bef46b3eb4b3005
parenta14383d6ccd3f5e373ed3576c8fd2adce27a4597 (diff)
Put the HRTF DirectParams into an anonymous struct
-rw-r--r--Alc/ALu.c52
-rw-r--r--Alc/mixer_inc.c18
-rw-r--r--OpenAL32/Include/alSource.h6
3 files changed, 39 insertions, 37 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index d0c17c0a..a30b396e 100644
--- a/Alc/ALu.c
+++ b/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
{
diff --git a/Alc/mixer_inc.c b/Alc/mixer_inc.c
index e836db45..97266d40 100644
--- a/Alc/mixer_inc.c
+++ b/Alc/mixer_inc.c
@@ -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;
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index 8c231d8b..d8ffc9aa 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -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