diff options
-rw-r--r-- | Alc/ALu.c | 58 | ||||
-rw-r--r-- | Alc/mixer_c.c | 2 | ||||
-rw-r--r-- | Alc/mixer_inc.c | 18 | ||||
-rw-r--r-- | Alc/mixer_neon.c | 2 | ||||
-rw-r--r-- | Alc/mixer_sse.c | 2 | ||||
-rw-r--r-- | OpenAL32/Include/alSource.h | 20 |
6 files changed, 52 insertions, 50 deletions
@@ -420,7 +420,7 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALCcontext *ALContext) if(DirectChannels != AL_FALSE) { - ALfloat (*SrcMatrix)[MaxChannels] = src->Direct.Gains; + ALfloat (*SrcMatrix)[MaxChannels] = src->Direct.Mix.Gains; for(i = 0;i < MAX_INPUT_CHANNELS;i++) { for(c = 0;c < MaxChannels;c++) @@ -447,12 +447,12 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALCcontext *ALContext) if(chans[c].channel == LFE) { /* Skip LFE */ - src->Direct.Hrtf.Params.Delay[c][0] = 0; - src->Direct.Hrtf.Params.Delay[c][1] = 0; + src->Direct.Mix.Hrtf.Params.Delay[c][0] = 0; + src->Direct.Mix.Hrtf.Params.Delay[c][1] = 0; for(i = 0;i < HRIR_LENGTH;i++) { - src->Direct.Hrtf.Params.Coeffs[c][i][0] = 0.0f; - src->Direct.Hrtf.Params.Coeffs[c][i][1] = 0.0f; + src->Direct.Mix.Hrtf.Params.Coeffs[c][i][0] = 0.0f; + src->Direct.Mix.Hrtf.Params.Coeffs[c][i][1] = 0.0f; } } else @@ -461,19 +461,19 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALCcontext *ALContext) * channel. */ GetLerpedHrtfCoeffs(Device->Hrtf, 0.0f, chans[c].angle, DryGain, - src->Direct.Hrtf.Params.Coeffs[c], - src->Direct.Hrtf.Params.Delay[c]); + src->Direct.Mix.Hrtf.Params.Coeffs[c], + src->Direct.Mix.Hrtf.Params.Delay[c]); } } ALSource->Hrtf.Counter = 0; - src->Direct.Hrtf.Params.IrSize = GetHrtfIrSize(Device->Hrtf); + src->Direct.Mix.Hrtf.Params.IrSize = GetHrtfIrSize(Device->Hrtf); - src->Direct.Hrtf.State = &ALSource->Hrtf; + src->Direct.Mix.Hrtf.State = &ALSource->Hrtf; src->DryMix = SelectHrtfMixer(); } else { - ALfloat (*SrcMatrix)[MaxChannels] = src->Direct.Gains; + ALfloat (*SrcMatrix)[MaxChannels] = src->Direct.Mix.Gains; for(i = 0;i < MAX_INPUT_CHANNELS;i++) { for(c = 0;c < MaxChannels;c++) @@ -876,8 +876,8 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALCcontext *ALContext) if(ALSource->Hrtf.Moving) { /* Calculate the normalized HRTF transition factor (delta). */ - delta = CalcHrtfDelta(src->Direct.Hrtf.Params.Gain, DryGain, - src->Direct.Hrtf.Params.Dir, Position); + delta = CalcHrtfDelta(src->Direct.Mix.Hrtf.Params.Gain, DryGain, + src->Direct.Mix.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) @@ -885,37 +885,37 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALCcontext *ALContext) ALSource->Hrtf.Counter = GetMovingHrtfCoeffs(Device->Hrtf, ev, az, DryGain, delta, ALSource->Hrtf.Counter, - src->Direct.Hrtf.Params.Coeffs[0], - src->Direct.Hrtf.Params.Delay[0], - src->Direct.Hrtf.Params.CoeffStep, - src->Direct.Hrtf.Params.DelayStep); - src->Direct.Hrtf.Params.Gain = DryGain; - src->Direct.Hrtf.Params.Dir[0] = Position[0]; - src->Direct.Hrtf.Params.Dir[1] = Position[1]; - src->Direct.Hrtf.Params.Dir[2] = Position[2]; + 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.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]; } } else { /* Get the initial (static) HRIR coefficients and delays. */ GetLerpedHrtfCoeffs(Device->Hrtf, ev, az, DryGain, - src->Direct.Hrtf.Params.Coeffs[0], - src->Direct.Hrtf.Params.Delay[0]); + src->Direct.Mix.Hrtf.Params.Coeffs[0], + src->Direct.Mix.Hrtf.Params.Delay[0]); ALSource->Hrtf.Counter = 0; ALSource->Hrtf.Moving = AL_TRUE; - src->Direct.Hrtf.Params.Gain = DryGain; - src->Direct.Hrtf.Params.Dir[0] = Position[0]; - src->Direct.Hrtf.Params.Dir[1] = Position[1]; - src->Direct.Hrtf.Params.Dir[2] = Position[2]; + 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.Hrtf.Params.IrSize = GetHrtfIrSize(Device->Hrtf); + src->Direct.Mix.Hrtf.Params.IrSize = GetHrtfIrSize(Device->Hrtf); - src->Direct.Hrtf.State = &ALSource->Hrtf; + src->Direct.Mix.Hrtf.State = &ALSource->Hrtf; src->DryMix = SelectHrtfMixer(); } else { - ALfloat (*Matrix)[MaxChannels] = src->Direct.Gains; + ALfloat (*Matrix)[MaxChannels] = src->Direct.Mix.Gains; ALfloat DirGain = 0.0f; ALfloat AmbientGain; diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c index 34309b12..393096db 100644 --- a/Alc/mixer_c.c +++ b/Alc/mixer_c.c @@ -94,7 +94,7 @@ void MixDirect_C(const DirectParams *params, const ALfloat *restrict data, ALuin for(c = 0;c < MaxChannels;c++) { - DrySend = params->Gains[srcchan][c]; + DrySend = params->Mix.Gains[srcchan][c]; if(!(DrySend > GAIN_SILENCE_THRESHOLD)) continue; diff --git a/Alc/mixer_inc.c b/Alc/mixer_inc.c index da8a7b31..7f70d247 100644 --- a/Alc/mixer_inc.c +++ b/Alc/mixer_inc.c @@ -36,15 +36,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.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; + const ALuint IrSize = params->Mix.Hrtf.Params.IrSize; + const ALint *restrict DelayStep = params->Mix.Hrtf.Params.DelayStep; + const ALfloat (*restrict CoeffStep)[2] = params->Mix.Hrtf.Params.CoeffStep; + 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]; + ALint Counter = maxu(params->Mix.Hrtf.State->Counter, OutPos) - OutPos; + ALuint Offset = params->Mix.Hrtf.State->Offset + OutPos; ALIGN(16) ALfloat Coeffs[HRIR_LENGTH][2]; ALuint Delay[2]; ALfloat left, right; diff --git a/Alc/mixer_neon.c b/Alc/mixer_neon.c index dd7c1c80..674181df 100644 --- a/Alc/mixer_neon.c +++ b/Alc/mixer_neon.c @@ -90,7 +90,7 @@ void MixDirect_Neon(const DirectParams *params, const ALfloat *restrict data, AL for(c = 0;c < MaxChannels;c++) { - DrySend = params->Gains[srcchan][c]; + DrySend = params->Mix.Gains[srcchan][c]; if(!(DrySend > GAIN_SILENCE_THRESHOLD)) continue; diff --git a/Alc/mixer_sse.c b/Alc/mixer_sse.c index 56a4bdae..9b04e8b5 100644 --- a/Alc/mixer_sse.c +++ b/Alc/mixer_sse.c @@ -153,7 +153,7 @@ void MixDirect_SSE(const DirectParams *params, const ALfloat *restrict data, ALu for(c = 0;c < MaxChannels;c++) { - DrySend = params->Gains[srcchan][c]; + DrySend = params->Mix.Gains[srcchan][c]; if(!(DrySend > GAIN_SILENCE_THRESHOLD)) continue; diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index 3fb3e553..0cc72d27 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -53,15 +53,17 @@ typedef struct DirectParams { ALfloat *ClickRemoval; ALfloat *PendingClicks; - 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 - * target (eg. FrontLeft). Not used with HRTF. */ - ALfloat Gains[MAX_INPUT_CHANNELS][MaxChannels]; + union { + 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 target (eg. FrontLeft). Not used with HRTF. */ + ALfloat Gains[MAX_INPUT_CHANNELS][MaxChannels]; + } Mix; ALfilterState LpFilter[MAX_INPUT_CHANNELS]; } DirectParams; |