aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-11-24 01:31:38 -0800
committerChris Robinson <[email protected]>2014-11-24 01:31:38 -0800
commit13608d4d61884a21ca5790b22fa121c2359253ed (patch)
treed86f8f2f1c25199a1a963c13a6c99b658f7659b5
parentc37a9719471a0ec72bf1716caf83f8ebd2a84e1a (diff)
Move the voice's last position and gain out of the Hrtf container
-rw-r--r--Alc/ALu.c20
-rw-r--r--OpenAL32/Include/alu.h5
2 files changed, 13 insertions, 12 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 393740ad..85948084 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -998,8 +998,8 @@ ALvoid CalcSourceParams(ALvoice *voice, const ALsource *ALSource, const ALCconte
if(voice->Direct.Moving)
{
/* Calculate the normalized HRTF transition factor (delta). */
- delta = CalcHrtfDelta(voice->Direct.Hrtf.Gain, DryGain,
- voice->Direct.Hrtf.Dir, Position);
+ delta = CalcHrtfDelta(voice->Direct.LastGain, DryGain,
+ voice->Direct.LastDir, Position);
/* If the delta is large enough, get the moving HRIR target
* coefficients, target delays, steppping values, and counter. */
if(delta > 0.001f)
@@ -1010,10 +1010,10 @@ ALvoid CalcSourceParams(ALvoice *voice, const ALsource *ALSource, const ALCconte
voice->Direct.Hrtf.Params[0].CoeffStep, voice->Direct.Hrtf.Params[0].DelayStep
);
voice->Direct.Counter = counter;
- voice->Direct.Hrtf.Gain = DryGain;
- voice->Direct.Hrtf.Dir[0] = Position[0];
- voice->Direct.Hrtf.Dir[1] = Position[1];
- voice->Direct.Hrtf.Dir[2] = Position[2];
+ voice->Direct.LastGain = DryGain;
+ voice->Direct.LastDir[0] = Position[0];
+ voice->Direct.LastDir[1] = Position[1];
+ voice->Direct.LastDir[2] = Position[2];
}
}
else
@@ -1024,10 +1024,10 @@ ALvoid CalcSourceParams(ALvoice *voice, const ALsource *ALSource, const ALCconte
voice->Direct.Hrtf.Params[0].Delay);
voice->Direct.Counter = 0;
voice->Direct.Moving = AL_TRUE;
- voice->Direct.Hrtf.Gain = DryGain;
- voice->Direct.Hrtf.Dir[0] = Position[0];
- voice->Direct.Hrtf.Dir[1] = Position[1];
- voice->Direct.Hrtf.Dir[2] = Position[2];
+ voice->Direct.LastGain = DryGain;
+ voice->Direct.LastDir[0] = Position[0];
+ voice->Direct.LastDir[1] = Position[1];
+ voice->Direct.LastDir[2] = Position[2];
}
voice->Direct.Hrtf.IrSize = GetHrtfIrSize(Device->Hrtf);
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 0462fda8..f4871413 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -64,6 +64,9 @@ typedef struct DirectParams {
ALboolean Moving;
/* Stepping counter for gain/coefficient fading. */
ALuint Counter;
+ /* Last direction (relative to listener) and gain of a moving source. */
+ ALfloat LastDir[3];
+ ALfloat LastGain;
struct {
enum ActiveFilters ActiveType;
@@ -75,8 +78,6 @@ typedef struct DirectParams {
HrtfParams Params[MAX_INPUT_CHANNELS];
HrtfState State[MAX_INPUT_CHANNELS];
ALuint IrSize;
- ALfloat Gain;
- ALfloat Dir[3];
} Hrtf;
MixGains Gains[MAX_INPUT_CHANNELS][MAX_OUTPUT_CHANNELS];
} DirectParams;