Move the input channel array out of the DirectParams and SendParams
This commit is contained in:
parent
e8202b915d
commit
5106f035df
111
Alc/ALu.c
111
Alc/ALu.c
@ -548,7 +548,7 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
|
||||
voice->DirectOut.Channels = Device->FOAOut.NumChannels;
|
||||
for(c = 0;c < num_channels;c++)
|
||||
ComputeFirstOrderGains(Device->FOAOut, matrix.m[c], DryGain,
|
||||
voice->Direct.Gains[c].Target);
|
||||
voice->Chan[c].Direct.Gains.Target);
|
||||
|
||||
for(i = 0;i < NumSends;i++)
|
||||
{
|
||||
@ -557,7 +557,7 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
|
||||
for(c = 0;c < num_channels;c++)
|
||||
{
|
||||
for(j = 0;j < MAX_EFFECT_CHANNELS;j++)
|
||||
voice->Send[i].Gains[c].Target[j] = 0.0f;
|
||||
voice->Chan[c].Send[i].Gains.Target[j] = 0.0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -566,7 +566,7 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
|
||||
{
|
||||
const ALeffectslot *Slot = SendSlots[i];
|
||||
ComputeFirstOrderGainsBF(Slot->ChanMap, Slot->NumChannels, matrix.m[c],
|
||||
WetGain[i], voice->Send[i].Gains[c].Target);
|
||||
WetGain[i], voice->Chan[c].Send[i].Gains.Target);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -586,9 +586,9 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
|
||||
{
|
||||
int idx;
|
||||
for(j = 0;j < MAX_OUTPUT_CHANNELS;j++)
|
||||
voice->Direct.Gains[c].Target[j] = 0.0f;
|
||||
voice->Chan[c].Direct.Gains.Target[j] = 0.0f;
|
||||
if((idx=GetChannelIdxByName(Device->RealOut, chans[c].channel)) != -1)
|
||||
voice->Direct.Gains[c].Target[idx] = DryGain;
|
||||
voice->Chan[c].Direct.Gains.Target[idx] = DryGain;
|
||||
}
|
||||
|
||||
/* Auxiliary sends still use normal panning since they mix to B-Format, which can't
|
||||
@ -602,13 +602,13 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
|
||||
if(!SendSlots[i])
|
||||
{
|
||||
for(j = 0;j < MAX_EFFECT_CHANNELS;j++)
|
||||
voice->Send[i].Gains[c].Target[j] = 0.0f;
|
||||
voice->Chan[c].Send[i].Gains.Target[j] = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
const ALeffectslot *Slot = SendSlots[i];
|
||||
ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs,
|
||||
WetGain[i], voice->Send[i].Gains[c].Target);
|
||||
WetGain[i], voice->Chan[c].Send[i].Gains.Target);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -627,18 +627,18 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
|
||||
if(chans[c].channel == LFE)
|
||||
{
|
||||
/* Skip LFE */
|
||||
voice->Direct.Hrtf[c].Target.Delay[0] = 0;
|
||||
voice->Direct.Hrtf[c].Target.Delay[1] = 0;
|
||||
voice->Chan[c].Direct.Hrtf.Target.Delay[0] = 0;
|
||||
voice->Chan[c].Direct.Hrtf.Target.Delay[1] = 0;
|
||||
for(i = 0;i < HRIR_LENGTH;i++)
|
||||
{
|
||||
voice->Direct.Hrtf[c].Target.Coeffs[i][0] = 0.0f;
|
||||
voice->Direct.Hrtf[c].Target.Coeffs[i][1] = 0.0f;
|
||||
voice->Chan[c].Direct.Hrtf.Target.Coeffs[i][0] = 0.0f;
|
||||
voice->Chan[c].Direct.Hrtf.Target.Coeffs[i][1] = 0.0f;
|
||||
}
|
||||
|
||||
for(i = 0;i < NumSends;i++)
|
||||
{
|
||||
for(j = 0;j < MAX_EFFECT_CHANNELS;j++)
|
||||
voice->Send[i].Gains[c].Target[j] = 0.0f;
|
||||
voice->Chan[c].Send[i].Gains.Target[j] = 0.0f;
|
||||
}
|
||||
|
||||
continue;
|
||||
@ -647,8 +647,8 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
|
||||
/* Get the static HRIR coefficients and delays for this channel. */
|
||||
GetLerpedHrtfCoeffs(Device->Hrtf,
|
||||
chans[c].elevation, chans[c].angle, 0.0f, DryGain,
|
||||
voice->Direct.Hrtf[c].Target.Coeffs,
|
||||
voice->Direct.Hrtf[c].Target.Delay
|
||||
voice->Chan[c].Direct.Hrtf.Target.Coeffs,
|
||||
voice->Chan[c].Direct.Hrtf.Target.Delay
|
||||
);
|
||||
|
||||
/* Normal panning for auxiliary sends. */
|
||||
@ -659,13 +659,13 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
|
||||
if(!SendSlots[i])
|
||||
{
|
||||
for(j = 0;j < MAX_EFFECT_CHANNELS;j++)
|
||||
voice->Send[i].Gains[c].Target[j] = 0.0f;
|
||||
voice->Chan[c].Send[i].Gains.Target[j] = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
const ALeffectslot *Slot = SendSlots[i];
|
||||
ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs,
|
||||
WetGain[i], voice->Send[i].Gains[c].Target);
|
||||
WetGain[i], voice->Chan[c].Send[i].Gains.Target);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -681,19 +681,19 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
|
||||
if(chans[c].channel == LFE)
|
||||
{
|
||||
for(j = 0;j < MAX_OUTPUT_CHANNELS;j++)
|
||||
voice->Direct.Gains[c].Target[j] = 0.0f;
|
||||
voice->Chan[c].Direct.Gains.Target[j] = 0.0f;
|
||||
if(Device->Dry.Buffer == Device->RealOut.Buffer)
|
||||
{
|
||||
int idx;
|
||||
if((idx=GetChannelIdxByName(Device->RealOut, chans[c].channel)) != -1)
|
||||
voice->Direct.Gains[c].Target[idx] = DryGain;
|
||||
voice->Chan[c].Direct.Gains.Target[idx] = DryGain;
|
||||
}
|
||||
|
||||
for(i = 0;i < NumSends;i++)
|
||||
{
|
||||
ALuint j;
|
||||
for(j = 0;j < MAX_EFFECT_CHANNELS;j++)
|
||||
voice->Send[i].Gains[c].Target[j] = 0.0f;
|
||||
voice->Chan[c].Send[i].Gains.Target[j] = 0.0f;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -703,10 +703,10 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
|
||||
/* Clamp X so it remains within 30 degrees of 0 or 180 degree azimuth. */
|
||||
ALfloat x = sinf(chans[c].angle) * cosf(chans[c].elevation);
|
||||
coeffs[0] = clampf(-x, -0.5f, 0.5f) + 0.5f;
|
||||
voice->Direct.Gains[c].Target[0] = coeffs[0] * DryGain;
|
||||
voice->Direct.Gains[c].Target[1] = (1.0f-coeffs[0]) * DryGain;
|
||||
voice->Chan[c].Direct.Gains.Target[0] = coeffs[0] * DryGain;
|
||||
voice->Chan[c].Direct.Gains.Target[1] = (1.0f-coeffs[0]) * DryGain;
|
||||
for(j = 2;j < MAX_OUTPUT_CHANNELS;j++)
|
||||
voice->Direct.Gains[c].Target[j] = 0.0f;
|
||||
voice->Chan[c].Direct.Gains.Target[j] = 0.0f;
|
||||
|
||||
CalcAngleCoeffs(chans[c].angle, chans[c].elevation, 0.0f, coeffs);
|
||||
}
|
||||
@ -714,7 +714,7 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
|
||||
{
|
||||
CalcAngleCoeffs(chans[c].angle, chans[c].elevation, 0.0f, coeffs);
|
||||
ComputePanningGains(Device->Dry, coeffs, DryGain,
|
||||
voice->Direct.Gains[c].Target);
|
||||
voice->Chan[c].Direct.Gains.Target);
|
||||
}
|
||||
|
||||
for(i = 0;i < NumSends;i++)
|
||||
@ -723,13 +723,13 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
|
||||
{
|
||||
ALuint j;
|
||||
for(j = 0;j < MAX_EFFECT_CHANNELS;j++)
|
||||
voice->Send[i].Gains[c].Target[j] = 0.0f;
|
||||
voice->Chan[c].Send[i].Gains.Target[j] = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
const ALeffectslot *Slot = SendSlots[i];
|
||||
ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs,
|
||||
WetGain[i], voice->Send[i].Gains[c].Target);
|
||||
WetGain[i], voice->Chan[c].Send[i].Gains.Target);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -747,15 +747,15 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
|
||||
DryGainLF = maxf(DryGainLF, 0.0001f);
|
||||
for(c = 0;c < num_channels;c++)
|
||||
{
|
||||
voice->Direct.Filters[c].ActiveType = AF_None;
|
||||
if(DryGainHF != 1.0f) voice->Direct.Filters[c].ActiveType |= AF_LowPass;
|
||||
if(DryGainLF != 1.0f) voice->Direct.Filters[c].ActiveType |= AF_HighPass;
|
||||
voice->Chan[c].Direct.FilterType = AF_None;
|
||||
if(DryGainHF != 1.0f) voice->Chan[c].Direct.FilterType |= AF_LowPass;
|
||||
if(DryGainLF != 1.0f) voice->Chan[c].Direct.FilterType |= AF_HighPass;
|
||||
ALfilterState_setParams(
|
||||
&voice->Direct.Filters[c].LowPass, ALfilterType_HighShelf,
|
||||
&voice->Chan[c].Direct.LowPass, ALfilterType_HighShelf,
|
||||
DryGainHF, hfscale, calc_rcpQ_from_slope(DryGainHF, 0.75f)
|
||||
);
|
||||
ALfilterState_setParams(
|
||||
&voice->Direct.Filters[c].HighPass, ALfilterType_LowShelf,
|
||||
&voice->Chan[c].Direct.HighPass, ALfilterType_LowShelf,
|
||||
DryGainLF, lfscale, calc_rcpQ_from_slope(DryGainLF, 0.75f)
|
||||
);
|
||||
}
|
||||
@ -770,15 +770,15 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *
|
||||
WetGainLF[i] = maxf(WetGainLF[i], 0.0001f);
|
||||
for(c = 0;c < num_channels;c++)
|
||||
{
|
||||
voice->Send[i].Filters[c].ActiveType = AF_None;
|
||||
if(WetGainHF[i] != 1.0f) voice->Send[i].Filters[c].ActiveType |= AF_LowPass;
|
||||
if(WetGainLF[i] != 1.0f) voice->Send[i].Filters[c].ActiveType |= AF_HighPass;
|
||||
voice->Chan[c].Send[i].FilterType = AF_None;
|
||||
if(WetGainHF[i] != 1.0f) voice->Chan[c].Send[i].FilterType |= AF_LowPass;
|
||||
if(WetGainLF[i] != 1.0f) voice->Chan[c].Send[i].FilterType |= AF_HighPass;
|
||||
ALfilterState_setParams(
|
||||
&voice->Send[i].Filters[c].LowPass, ALfilterType_HighShelf,
|
||||
&voice->Chan[c].Send[i].LowPass, ALfilterType_HighShelf,
|
||||
WetGainHF[i], hfscale, calc_rcpQ_from_slope(WetGainHF[i], 0.75f)
|
||||
);
|
||||
ALfilterState_setParams(
|
||||
&voice->Send[i].Filters[c].HighPass, ALfilterType_LowShelf,
|
||||
&voice->Chan[c].Send[i].HighPass, ALfilterType_LowShelf,
|
||||
WetGainLF[i], lfscale, calc_rcpQ_from_slope(WetGainLF[i], 0.75f)
|
||||
);
|
||||
}
|
||||
@ -1161,8 +1161,8 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro
|
||||
|
||||
/* Get the HRIR coefficients and delays. */
|
||||
GetLerpedHrtfCoeffs(Device->Hrtf, ev, az, spread, DryGain,
|
||||
voice->Direct.Hrtf[0].Target.Coeffs,
|
||||
voice->Direct.Hrtf[0].Target.Delay);
|
||||
voice->Chan[0].Direct.Hrtf.Target.Coeffs,
|
||||
voice->Chan[0].Direct.Hrtf.Target.Delay);
|
||||
|
||||
CalcDirectionCoeffs(dir, spread, coeffs);
|
||||
|
||||
@ -1172,13 +1172,13 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro
|
||||
{
|
||||
ALuint j;
|
||||
for(j = 0;j < MAX_EFFECT_CHANNELS;j++)
|
||||
voice->Send[i].Gains[0].Target[j] = 0.0f;
|
||||
voice->Chan[0].Send[i].Gains.Target[j] = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
const ALeffectslot *Slot = SendSlots[i];
|
||||
ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs,
|
||||
WetGain[i], voice->Send[i].Gains[0].Target);
|
||||
WetGain[i], voice->Chan[0].Send[i].Gains.Target);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1209,17 +1209,18 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro
|
||||
/* Clamp X so it remains within 30 degrees of 0 or 180 degree azimuth. */
|
||||
ALfloat x = -dir[0] * (0.5f * (cosf(spread*0.5f) + 1.0f));
|
||||
x = clampf(x, -0.5f, 0.5f) + 0.5f;
|
||||
voice->Direct.Gains[0].Target[0] = x * DryGain;
|
||||
voice->Direct.Gains[0].Target[1] = (1.0f-x) * DryGain;
|
||||
voice->Chan[0].Direct.Gains.Target[0] = x * DryGain;
|
||||
voice->Chan[0].Direct.Gains.Target[1] = (1.0f-x) * DryGain;
|
||||
for(i = 2;i < MAX_OUTPUT_CHANNELS;i++)
|
||||
voice->Direct.Gains[0].Target[i] = 0.0f;
|
||||
voice->Chan[0].Direct.Gains.Target[i] = 0.0f;
|
||||
|
||||
CalcDirectionCoeffs(dir, spread, coeffs);
|
||||
}
|
||||
else
|
||||
{
|
||||
CalcDirectionCoeffs(dir, spread, coeffs);
|
||||
ComputePanningGains(Device->Dry, coeffs, DryGain, voice->Direct.Gains[0].Target);
|
||||
ComputePanningGains(Device->Dry, coeffs, DryGain,
|
||||
voice->Chan[0].Direct.Gains.Target);
|
||||
}
|
||||
|
||||
for(i = 0;i < NumSends;i++)
|
||||
@ -1228,13 +1229,13 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro
|
||||
{
|
||||
ALuint j;
|
||||
for(j = 0;j < MAX_EFFECT_CHANNELS;j++)
|
||||
voice->Send[i].Gains[0].Target[j] = 0.0f;
|
||||
voice->Chan[0].Send[i].Gains.Target[j] = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
const ALeffectslot *Slot = SendSlots[i];
|
||||
ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs,
|
||||
WetGain[i], voice->Send[i].Gains[0].Target);
|
||||
WetGain[i], voice->Chan[0].Send[i].Gains.Target);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1248,15 +1249,15 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro
|
||||
Frequency;
|
||||
DryGainHF = maxf(DryGainHF, 0.0001f);
|
||||
DryGainLF = maxf(DryGainLF, 0.0001f);
|
||||
voice->Direct.Filters[0].ActiveType = AF_None;
|
||||
if(DryGainHF != 1.0f) voice->Direct.Filters[0].ActiveType |= AF_LowPass;
|
||||
if(DryGainLF != 1.0f) voice->Direct.Filters[0].ActiveType |= AF_HighPass;
|
||||
voice->Chan[0].Direct.FilterType = AF_None;
|
||||
if(DryGainHF != 1.0f) voice->Chan[0].Direct.FilterType |= AF_LowPass;
|
||||
if(DryGainLF != 1.0f) voice->Chan[0].Direct.FilterType |= AF_HighPass;
|
||||
ALfilterState_setParams(
|
||||
&voice->Direct.Filters[0].LowPass, ALfilterType_HighShelf,
|
||||
&voice->Chan[0].Direct.LowPass, ALfilterType_HighShelf,
|
||||
DryGainHF, hfscale, calc_rcpQ_from_slope(DryGainHF, 0.75f)
|
||||
);
|
||||
ALfilterState_setParams(
|
||||
&voice->Direct.Filters[0].HighPass, ALfilterType_LowShelf,
|
||||
&voice->Chan[0].Direct.HighPass, ALfilterType_LowShelf,
|
||||
DryGainLF, lfscale, calc_rcpQ_from_slope(DryGainLF, 0.75f)
|
||||
);
|
||||
}
|
||||
@ -1268,15 +1269,15 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro
|
||||
Frequency;
|
||||
WetGainHF[i] = maxf(WetGainHF[i], 0.0001f);
|
||||
WetGainLF[i] = maxf(WetGainLF[i], 0.0001f);
|
||||
voice->Send[i].Filters[0].ActiveType = AF_None;
|
||||
if(WetGainHF[i] != 1.0f) voice->Send[i].Filters[0].ActiveType |= AF_LowPass;
|
||||
if(WetGainLF[i] != 1.0f) voice->Send[i].Filters[0].ActiveType |= AF_HighPass;
|
||||
voice->Chan[0].Send[i].FilterType = AF_None;
|
||||
if(WetGainHF[i] != 1.0f) voice->Chan[0].Send[i].FilterType |= AF_LowPass;
|
||||
if(WetGainLF[i] != 1.0f) voice->Chan[0].Send[i].FilterType |= AF_HighPass;
|
||||
ALfilterState_setParams(
|
||||
&voice->Send[i].Filters[0].LowPass, ALfilterType_HighShelf,
|
||||
&voice->Chan[0].Send[i].LowPass, ALfilterType_HighShelf,
|
||||
WetGainHF[i], hfscale, calc_rcpQ_from_slope(WetGainHF[i], 0.75f)
|
||||
);
|
||||
ALfilterState_setParams(
|
||||
&voice->Send[i].Filters[0].HighPass, ALfilterType_LowShelf,
|
||||
&voice->Chan[0].Send[i].HighPass, ALfilterType_LowShelf,
|
||||
WetGainLF[i], lfscale, calc_rcpQ_from_slope(WetGainLF[i], 0.75f)
|
||||
);
|
||||
}
|
||||
|
38
Alc/mixer.c
38
Alc/mixer.c
@ -553,18 +553,17 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam
|
||||
Device->ResampledData, DstBufferSize
|
||||
);
|
||||
{
|
||||
DirectParams *parms = &voice->Direct;
|
||||
DirectParams *parms = &voice->Chan[chan].Direct;
|
||||
const ALfloat *samples;
|
||||
|
||||
samples = DoFilters(
|
||||
&parms->Filters[chan].LowPass, &parms->Filters[chan].HighPass,
|
||||
Device->FilteredData, ResampledData, DstBufferSize,
|
||||
parms->Filters[chan].ActiveType
|
||||
&parms->LowPass, &parms->HighPass, Device->FilteredData,
|
||||
ResampledData, DstBufferSize, parms->FilterType
|
||||
);
|
||||
if(!voice->IsHrtf)
|
||||
{
|
||||
ALfloat *restrict currents = parms->Gains[chan].Current;
|
||||
const ALfloat *targets = parms->Gains[chan].Target;
|
||||
ALfloat *restrict currents = parms->Gains.Current;
|
||||
const ALfloat *targets = parms->Gains.Target;
|
||||
MixGains gains[MAX_OUTPUT_CHANNELS];
|
||||
|
||||
if(!Counter)
|
||||
@ -607,7 +606,7 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam
|
||||
|
||||
if(!Counter)
|
||||
{
|
||||
parms->Hrtf[chan].Current = parms->Hrtf[chan].Target;
|
||||
parms->Hrtf.Current = parms->Hrtf.Target;
|
||||
for(j = 0;j < HRIR_LENGTH;j++)
|
||||
{
|
||||
hrtfparams.Steps.Coeffs[j][0] = 0.0f;
|
||||
@ -622,18 +621,18 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam
|
||||
ALint delaydiff;
|
||||
for(j = 0;j < IrSize;j++)
|
||||
{
|
||||
coeffdiff = parms->Hrtf[chan].Target.Coeffs[j][0] - parms->Hrtf[chan].Current.Coeffs[j][0];
|
||||
coeffdiff = parms->Hrtf.Target.Coeffs[j][0] - parms->Hrtf.Current.Coeffs[j][0];
|
||||
hrtfparams.Steps.Coeffs[j][0] = coeffdiff * Delta;
|
||||
coeffdiff = parms->Hrtf[chan].Target.Coeffs[j][1] - parms->Hrtf[chan].Current.Coeffs[j][1];
|
||||
coeffdiff = parms->Hrtf.Target.Coeffs[j][1] - parms->Hrtf.Current.Coeffs[j][1];
|
||||
hrtfparams.Steps.Coeffs[j][1] = coeffdiff * Delta;
|
||||
}
|
||||
delaydiff = (ALint)(parms->Hrtf[chan].Target.Delay[0] - parms->Hrtf[chan].Current.Delay[0]);
|
||||
delaydiff = (ALint)(parms->Hrtf.Target.Delay[0] - parms->Hrtf.Current.Delay[0]);
|
||||
hrtfparams.Steps.Delay[0] = fastf2i((ALfloat)delaydiff * Delta);
|
||||
delaydiff = (ALint)(parms->Hrtf[chan].Target.Delay[1] - parms->Hrtf[chan].Current.Delay[1]);
|
||||
delaydiff = (ALint)(parms->Hrtf.Target.Delay[1] - parms->Hrtf.Current.Delay[1]);
|
||||
hrtfparams.Steps.Delay[1] = fastf2i((ALfloat)delaydiff * Delta);
|
||||
}
|
||||
hrtfparams.Target = &parms->Hrtf[chan].Target;
|
||||
hrtfparams.Current = &parms->Hrtf[chan].Current;
|
||||
hrtfparams.Target = &parms->Hrtf.Target;
|
||||
hrtfparams.Current = &parms->Hrtf.Current;
|
||||
|
||||
lidx = GetChannelIdxByName(Device->RealOut, FrontLeft);
|
||||
ridx = GetChannelIdxByName(Device->RealOut, FrontRight);
|
||||
@ -641,15 +640,15 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam
|
||||
|
||||
MixHrtfSamples(voice->DirectOut.Buffer, lidx, ridx, samples, Counter,
|
||||
voice->Offset, OutPos, IrSize, &hrtfparams,
|
||||
&parms->Hrtf[chan].State, DstBufferSize);
|
||||
&parms->Hrtf.State, DstBufferSize);
|
||||
}
|
||||
}
|
||||
|
||||
for(j = 0;j < Device->NumAuxSends;j++)
|
||||
{
|
||||
SendParams *parms = &voice->Send[j];
|
||||
ALfloat *restrict currents = parms->Gains[chan].Current;
|
||||
const ALfloat *targets = parms->Gains[chan].Target;
|
||||
SendParams *parms = &voice->Chan[chan].Send[j];
|
||||
ALfloat *restrict currents = parms->Gains.Current;
|
||||
const ALfloat *targets = parms->Gains.Target;
|
||||
MixGains gains[MAX_OUTPUT_CHANNELS];
|
||||
const ALfloat *samples;
|
||||
|
||||
@ -657,9 +656,8 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam
|
||||
continue;
|
||||
|
||||
samples = DoFilters(
|
||||
&parms->Filters[chan].LowPass, &parms->Filters[chan].HighPass,
|
||||
Device->FilteredData, ResampledData, DstBufferSize,
|
||||
parms->Filters[chan].ActiveType
|
||||
&parms->LowPass, &parms->HighPass, Device->FilteredData,
|
||||
ResampledData, DstBufferSize, parms->FilterType
|
||||
);
|
||||
|
||||
if(!Counter)
|
||||
|
@ -51,8 +51,10 @@ typedef struct ALvoice {
|
||||
ALuint Channels;
|
||||
} SendOut[MAX_SENDS];
|
||||
|
||||
DirectParams Direct;
|
||||
SendParams Send[MAX_SENDS];
|
||||
struct {
|
||||
DirectParams Direct;
|
||||
SendParams Send[MAX_SENDS];
|
||||
} Chan[MAX_INPUT_CHANNELS];
|
||||
} ALvoice;
|
||||
|
||||
|
||||
|
@ -125,35 +125,31 @@ typedef struct MixHrtfParams {
|
||||
} MixHrtfParams;
|
||||
|
||||
typedef struct DirectParams {
|
||||
struct {
|
||||
enum ActiveFilters ActiveType;
|
||||
ALfilterState LowPass;
|
||||
ALfilterState HighPass;
|
||||
} Filters[MAX_INPUT_CHANNELS];
|
||||
enum ActiveFilters FilterType;
|
||||
ALfilterState LowPass;
|
||||
ALfilterState HighPass;
|
||||
|
||||
struct {
|
||||
HrtfParams Current;
|
||||
HrtfParams Target;
|
||||
HrtfState State;
|
||||
} Hrtf[MAX_INPUT_CHANNELS];
|
||||
} Hrtf;
|
||||
|
||||
struct {
|
||||
ALfloat Current[MAX_OUTPUT_CHANNELS];
|
||||
ALfloat Target[MAX_OUTPUT_CHANNELS];
|
||||
} Gains[MAX_INPUT_CHANNELS];
|
||||
} Gains;
|
||||
} DirectParams;
|
||||
|
||||
typedef struct SendParams {
|
||||
struct {
|
||||
enum ActiveFilters ActiveType;
|
||||
ALfilterState LowPass;
|
||||
ALfilterState HighPass;
|
||||
} Filters[MAX_INPUT_CHANNELS];
|
||||
enum ActiveFilters FilterType;
|
||||
ALfilterState LowPass;
|
||||
ALfilterState HighPass;
|
||||
|
||||
struct {
|
||||
ALfloat Current[MAX_OUTPUT_CHANNELS];
|
||||
ALfloat Target[MAX_OUTPUT_CHANNELS];
|
||||
} Gains[MAX_INPUT_CHANNELS];
|
||||
} Gains;
|
||||
} SendParams;
|
||||
|
||||
|
||||
|
@ -3005,11 +3005,11 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state)
|
||||
{
|
||||
ALsizei j;
|
||||
for(j = 0;j < HRTF_HISTORY_LENGTH;j++)
|
||||
voice->Direct.Hrtf[i].State.History[j] = 0.0f;
|
||||
voice->Chan[i].Direct.Hrtf.State.History[j] = 0.0f;
|
||||
for(j = 0;j < HRIR_LENGTH;j++)
|
||||
{
|
||||
voice->Direct.Hrtf[i].State.Values[j][0] = 0.0f;
|
||||
voice->Direct.Hrtf[i].State.Values[j][1] = 0.0f;
|
||||
voice->Chan[i].Direct.Hrtf.State.Values[j][0] = 0.0f;
|
||||
voice->Chan[i].Direct.Hrtf.State.Values[j][1] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user