diff options
author | Chris Robinson <[email protected]> | 2014-03-23 03:03:03 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-03-23 03:03:03 -0700 |
commit | 0ce0a88fd67ddcf7cb5248ac08d36cfa1c0013eb (patch) | |
tree | 97529b194e1ae3c33b7d4faa605ee3ead4e350d2 /Alc | |
parent | b0d511a8609cd2f3c10fd5b65603211a14c8141e (diff) |
Move the step counter and moving flag to DirectParams
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALu.c | 21 | ||||
-rw-r--r-- | Alc/mixer.c | 6 | ||||
-rw-r--r-- | Alc/mixer_inc.c | 2 |
3 files changed, 19 insertions, 10 deletions
@@ -438,6 +438,8 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALCcontext *ALContext) } } } + src->Direct.Counter = 0; + src->Direct.Moving = AL_TRUE; src->DryMix = SelectDirectMixer(); } else if(Device->Hrtf) @@ -465,7 +467,8 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALCcontext *ALContext) src->Direct.Mix.Hrtf.Params.Delay[c]); } } - src->Direct.Mix.Hrtf.State.Counter = 0; + src->Direct.Counter = 0; + src->Direct.Moving = AL_TRUE; src->Direct.Mix.Hrtf.Params.IrSize = GetHrtfIrSize(Device->Hrtf); src->DryMix = SelectHrtfMixer(); @@ -491,6 +494,8 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALCcontext *ALContext) ComputeAngleGains(Device, chans[c].angle, hwidth, DryGain, SrcMatrix[c]); } + src->Direct.Counter = 0; + src->Direct.Moving = AL_TRUE; src->DryMix = SelectDirectMixer(); } for(i = 0;i < NumSends;i++) @@ -872,7 +877,7 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALCcontext *ALContext) } /* Check to see if the HRIR is already moving. */ - if(src->Direct.Mix.Hrtf.State.Moving) + if(src->Direct.Moving) { /* Calculate the normalized HRTF transition factor (delta). */ delta = CalcHrtfDelta(src->Direct.Mix.Hrtf.Params.Gain, DryGain, @@ -883,12 +888,12 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALCcontext *ALContext) { ALuint counter = GetMovingHrtfCoeffs(Device->Hrtf, ev, az, DryGain, delta, - src->Direct.Mix.Hrtf.State.Counter, + src->Direct.Counter, src->Direct.Mix.Hrtf.Params.Coeffs[0], src->Direct.Mix.Hrtf.Params.Delay[0], src->Direct.Mix.Hrtf.Params.CoeffStep, src->Direct.Mix.Hrtf.Params.DelayStep); - src->Direct.Mix.Hrtf.State.Counter = counter; + 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]; @@ -901,8 +906,8 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALCcontext *ALContext) GetLerpedHrtfCoeffs(Device->Hrtf, ev, az, DryGain, src->Direct.Mix.Hrtf.Params.Coeffs[0], src->Direct.Mix.Hrtf.Params.Delay[0]); - src->Direct.Mix.Hrtf.State.Counter = 0; - src->Direct.Mix.Hrtf.State.Moving = AL_TRUE; + 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]; @@ -945,6 +950,10 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALCcontext *ALContext) enum Channel chan = Device->Speaker2Chan[i]; Matrix[0][chan] = maxf(Matrix[0][chan], AmbientGain); } + + src->Direct.Counter = 0; + src->Direct.Moving = AL_TRUE; + src->DryMix = SelectDirectMixer(); } for(i = 0;i < NumSends;i++) diff --git a/Alc/mixer.c b/Alc/mixer.c index 22c5aad7..8ce7d845 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -413,10 +413,10 @@ ALvoid MixSource(ALactivesource *src, ALCdevice *Device, ALuint SamplesToDo) Source->position_fraction = DataPosFrac; src->Direct.Mix.Hrtf.State.Offset += OutPos; if(State == AL_PLAYING) - src->Direct.Mix.Hrtf.State.Counter = maxu(src->Direct.Mix.Hrtf.State.Counter, OutPos) - OutPos; + src->Direct.Counter = maxu(src->Direct.Counter, OutPos) - OutPos; else { - src->Direct.Mix.Hrtf.State.Counter = 0; - src->Direct.Mix.Hrtf.State.Moving = AL_FALSE; + src->Direct.Counter = 0; + src->Direct.Moving = AL_FALSE; } } diff --git a/Alc/mixer_inc.c b/Alc/mixer_inc.c index c9c9bd6b..1cb1967d 100644 --- a/Alc/mixer_inc.c +++ b/Alc/mixer_inc.c @@ -43,8 +43,8 @@ void MixDirect_Hrtf(DirectParams *params, const ALfloat *restrict data, ALuint s 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]; - ALint Counter = maxu(params->Mix.Hrtf.State.Counter, OutPos) - OutPos; ALuint Offset = params->Mix.Hrtf.State.Offset + OutPos; + ALint Counter = maxu(params->Counter, OutPos) - OutPos; ALIGN(16) ALfloat Coeffs[HRIR_LENGTH][2]; ALuint Delay[2]; ALfloat left, right; |