Reduce the amount of variables that hold the same value
This commit is contained in:
parent
95ea3fdd05
commit
49e5c53591
14
Alc/ALu.c
14
Alc/ALu.c
@ -954,9 +954,9 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Distance, const
|
||||
ALfloat gainHF = maxf(DryGainHF, 0.001f); /* Limit -60dB */
|
||||
ALfloat gainLF = maxf(DryGainLF, 0.001f);
|
||||
|
||||
voice->Direct.Params[0].FilterType = AF_None;
|
||||
if(gainHF != 1.0f) voice->Direct.Params[0].FilterType |= AF_LowPass;
|
||||
if(gainLF != 1.0f) voice->Direct.Params[0].FilterType |= AF_HighPass;
|
||||
voice->Direct.FilterType = AF_None;
|
||||
if(gainHF != 1.0f) voice->Direct.FilterType |= AF_LowPass;
|
||||
if(gainLF != 1.0f) voice->Direct.FilterType |= AF_HighPass;
|
||||
ALfilterState_setParams(
|
||||
&voice->Direct.Params[0].LowPass, ALfilterType_HighShelf,
|
||||
gainHF, hfScale, calc_rcpQ_from_slope(gainHF, 1.0f)
|
||||
@ -967,7 +967,6 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Distance, const
|
||||
);
|
||||
for(c = 1;c < num_channels;c++)
|
||||
{
|
||||
voice->Direct.Params[c].FilterType = voice->Direct.Params[0].FilterType;
|
||||
ALfilterState_copyParams(&voice->Direct.Params[c].LowPass,
|
||||
&voice->Direct.Params[0].LowPass);
|
||||
ALfilterState_copyParams(&voice->Direct.Params[c].HighPass,
|
||||
@ -981,9 +980,9 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Distance, const
|
||||
ALfloat gainHF = maxf(WetGainHF[i], 0.001f);
|
||||
ALfloat gainLF = maxf(WetGainLF[i], 0.001f);
|
||||
|
||||
voice->Send[i].Params[0].FilterType = AF_None;
|
||||
if(gainHF != 1.0f) voice->Send[i].Params[0].FilterType |= AF_LowPass;
|
||||
if(gainLF != 1.0f) voice->Send[i].Params[0].FilterType |= AF_HighPass;
|
||||
voice->Send[i].FilterType = AF_None;
|
||||
if(gainHF != 1.0f) voice->Send[i].FilterType |= AF_LowPass;
|
||||
if(gainLF != 1.0f) voice->Send[i].FilterType |= AF_HighPass;
|
||||
ALfilterState_setParams(
|
||||
&voice->Send[i].Params[0].LowPass, ALfilterType_HighShelf,
|
||||
gainHF, hfScale, calc_rcpQ_from_slope(gainHF, 1.0f)
|
||||
@ -994,7 +993,6 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Distance, const
|
||||
);
|
||||
for(c = 1;c < num_channels;c++)
|
||||
{
|
||||
voice->Send[i].Params[c].FilterType = voice->Send[i].Params[0].FilterType;
|
||||
ALfilterState_copyParams(&voice->Send[i].Params[c].LowPass,
|
||||
&voice->Send[i].Params[0].LowPass);
|
||||
ALfilterState_copyParams(&voice->Send[i].Params[c].HighPass,
|
||||
|
@ -457,7 +457,7 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
|
||||
|
||||
samples = DoFilters(
|
||||
&parms->LowPass, &parms->HighPass, Device->FilteredData,
|
||||
ResampledData, DstBufferSize, parms->FilterType
|
||||
ResampledData, DstBufferSize, voice->Direct.FilterType
|
||||
);
|
||||
if(!(voice->Flags&VOICE_HAS_HRTF))
|
||||
{
|
||||
@ -598,7 +598,7 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
|
||||
|
||||
samples = DoFilters(
|
||||
&parms->LowPass, &parms->HighPass, Device->FilteredData,
|
||||
ResampledData, DstBufferSize, parms->FilterType
|
||||
ResampledData, DstBufferSize, voice->Send[send].FilterType
|
||||
);
|
||||
|
||||
if(!Counter)
|
||||
|
@ -144,7 +144,6 @@ typedef struct MixHrtfParams {
|
||||
|
||||
|
||||
typedef struct DirectParams {
|
||||
enum ActiveFilters FilterType;
|
||||
ALfilterState LowPass;
|
||||
ALfilterState HighPass;
|
||||
|
||||
@ -163,7 +162,6 @@ typedef struct DirectParams {
|
||||
} DirectParams;
|
||||
|
||||
typedef struct SendParams {
|
||||
enum ActiveFilters FilterType;
|
||||
ALfilterState LowPass;
|
||||
ALfilterState HighPass;
|
||||
|
||||
@ -279,6 +277,7 @@ typedef struct ALvoice {
|
||||
InterpState ResampleState;
|
||||
|
||||
struct {
|
||||
enum ActiveFilters FilterType;
|
||||
DirectParams Params[MAX_INPUT_CHANNELS];
|
||||
|
||||
ALfloat (*Buffer)[BUFFERSIZE];
|
||||
@ -287,6 +286,7 @@ typedef struct ALvoice {
|
||||
} Direct;
|
||||
|
||||
struct {
|
||||
enum ActiveFilters FilterType;
|
||||
SendParams Params[MAX_INPUT_CHANNELS];
|
||||
|
||||
ALfloat (*Buffer)[BUFFERSIZE];
|
||||
|
Loading…
x
Reference in New Issue
Block a user