Rename minF/maxF/clampF to minf/maxf/clampf for consistency
This commit is contained in:
parent
04dad28228
commit
9f5bf5f930
20
Alc/ALu.c
20
Alc/ALu.c
@ -180,7 +180,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate gains */
|
/* Calculate gains */
|
||||||
DryGain = clampF(SourceVolume, MinVolume, MaxVolume);
|
DryGain = clampf(SourceVolume, MinVolume, MaxVolume);
|
||||||
DryGainHF = 1.0f;
|
DryGainHF = 1.0f;
|
||||||
switch(ALSource->DirectFilter.type)
|
switch(ALSource->DirectFilter.type)
|
||||||
{
|
{
|
||||||
@ -191,7 +191,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
|
|||||||
}
|
}
|
||||||
for(i = 0;i < NumSends;i++)
|
for(i = 0;i < NumSends;i++)
|
||||||
{
|
{
|
||||||
WetGain[i] = clampF(SourceVolume, MinVolume, MaxVolume);
|
WetGain[i] = clampf(SourceVolume, MinVolume, MaxVolume);
|
||||||
WetGainHF[i] = 1.0f;
|
WetGainHF[i] = 1.0f;
|
||||||
switch(ALSource->Send[i].WetFilter.type)
|
switch(ALSource->Send[i].WetFilter.type)
|
||||||
{
|
{
|
||||||
@ -497,7 +497,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
|
|||||||
ALContext->DistanceModel)
|
ALContext->DistanceModel)
|
||||||
{
|
{
|
||||||
case InverseDistanceClamped:
|
case InverseDistanceClamped:
|
||||||
ClampedDist = clampF(ClampedDist, MinDist, MaxDist);
|
ClampedDist = clampf(ClampedDist, MinDist, MaxDist);
|
||||||
if(MaxDist < MinDist)
|
if(MaxDist < MinDist)
|
||||||
break;
|
break;
|
||||||
//fall-through
|
//fall-through
|
||||||
@ -515,7 +515,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LinearDistanceClamped:
|
case LinearDistanceClamped:
|
||||||
ClampedDist = clampF(ClampedDist, MinDist, MaxDist);
|
ClampedDist = clampf(ClampedDist, MinDist, MaxDist);
|
||||||
if(MaxDist < MinDist)
|
if(MaxDist < MinDist)
|
||||||
break;
|
break;
|
||||||
//fall-through
|
//fall-through
|
||||||
@ -523,17 +523,17 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
|
|||||||
if(MaxDist != MinDist)
|
if(MaxDist != MinDist)
|
||||||
{
|
{
|
||||||
Attenuation = 1.0f - (Rolloff*(ClampedDist-MinDist)/(MaxDist - MinDist));
|
Attenuation = 1.0f - (Rolloff*(ClampedDist-MinDist)/(MaxDist - MinDist));
|
||||||
Attenuation = maxF(Attenuation, 0.0f);
|
Attenuation = maxf(Attenuation, 0.0f);
|
||||||
for(i = 0;i < NumSends;i++)
|
for(i = 0;i < NumSends;i++)
|
||||||
{
|
{
|
||||||
RoomAttenuation[i] = 1.0f - (RoomRolloff[i]*(ClampedDist-MinDist)/(MaxDist - MinDist));
|
RoomAttenuation[i] = 1.0f - (RoomRolloff[i]*(ClampedDist-MinDist)/(MaxDist - MinDist));
|
||||||
RoomAttenuation[i] = maxF(RoomAttenuation[i], 0.0f);
|
RoomAttenuation[i] = maxf(RoomAttenuation[i], 0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ExponentDistanceClamped:
|
case ExponentDistanceClamped:
|
||||||
ClampedDist = clampF(ClampedDist, MinDist, MaxDist);
|
ClampedDist = clampf(ClampedDist, MinDist, MaxDist);
|
||||||
if(MaxDist < MinDist)
|
if(MaxDist < MinDist)
|
||||||
break;
|
break;
|
||||||
//fall-through
|
//fall-through
|
||||||
@ -601,9 +601,9 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clamp to Min/Max Gain
|
// Clamp to Min/Max Gain
|
||||||
DryGain = clampF(DryGain, MinVolume, MaxVolume);
|
DryGain = clampf(DryGain, MinVolume, MaxVolume);
|
||||||
for(i = 0;i < NumSends;i++)
|
for(i = 0;i < NumSends;i++)
|
||||||
WetGain[i] = clampF(WetGain[i], MinVolume, MaxVolume);
|
WetGain[i] = clampf(WetGain[i], MinVolume, MaxVolume);
|
||||||
|
|
||||||
// Apply filter gains and filters
|
// Apply filter gains and filters
|
||||||
switch(ALSource->DirectFilter.type)
|
switch(ALSource->DirectFilter.type)
|
||||||
@ -761,7 +761,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
|
|||||||
ALfloat length;
|
ALfloat length;
|
||||||
ALint pos;
|
ALint pos;
|
||||||
|
|
||||||
length = maxF(Distance, MinDist);
|
length = maxf(Distance, MinDist);
|
||||||
if(length > 0.0f)
|
if(length > 0.0f)
|
||||||
{
|
{
|
||||||
ALfloat invlen = 1.0f/length;
|
ALfloat invlen = 1.0f/length;
|
||||||
|
@ -391,7 +391,7 @@ static ALfloat CalcLimitedHfRatio(ALfloat hfRatio, ALfloat airAbsorptionGainHF,
|
|||||||
/* Using the limit calculated above, apply the upper bound to the HF
|
/* Using the limit calculated above, apply the upper bound to the HF
|
||||||
* ratio. Also need to limit the result to a minimum of 0.1, just like the
|
* ratio. Also need to limit the result to a minimum of 0.1, just like the
|
||||||
* HF ratio parameter. */
|
* HF ratio parameter. */
|
||||||
return clampF(limitRatio, 0.1f, hfRatio);
|
return clampf(limitRatio, 0.1f, hfRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the coefficient for a HF (and eventually LF) decay damping
|
// Calculate the coefficient for a HF (and eventually LF) decay damping
|
||||||
@ -415,7 +415,7 @@ static __inline ALfloat CalcDampingCoeff(ALfloat hfRatio, ALfloat length, ALfloa
|
|||||||
|
|
||||||
// Very low decay times will produce minimal output, so apply an
|
// Very low decay times will produce minimal output, so apply an
|
||||||
// upper bound to the coefficient.
|
// upper bound to the coefficient.
|
||||||
coeff = minF(coeff, 0.98f);
|
coeff = minf(coeff, 0.98f);
|
||||||
}
|
}
|
||||||
return coeff;
|
return coeff;
|
||||||
}
|
}
|
||||||
|
@ -89,8 +89,8 @@ ALfloat CalcHrtfDelta(ALfloat oldGain, ALfloat newGain, const ALfloat olddir[3],
|
|||||||
ALfloat gainChange, angleChange;
|
ALfloat gainChange, angleChange;
|
||||||
|
|
||||||
// Calculate the normalized dB gain change.
|
// Calculate the normalized dB gain change.
|
||||||
newGain = maxF(newGain, 0.0001f);
|
newGain = maxf(newGain, 0.0001f);
|
||||||
oldGain = maxF(oldGain, 0.0001f);
|
oldGain = maxf(oldGain, 0.0001f);
|
||||||
gainChange = aluFabs(log10(newGain / oldGain) / log10(0.0001f));
|
gainChange = aluFabs(log10(newGain / oldGain) / log10(0.0001f));
|
||||||
|
|
||||||
// Calculate the normalized listener to source angle change when there is
|
// Calculate the normalized listener to source angle change when there is
|
||||||
@ -109,7 +109,7 @@ ALfloat CalcHrtfDelta(ALfloat oldGain, ALfloat newGain, const ALfloat olddir[3],
|
|||||||
|
|
||||||
// Use the largest of the two changes for the delta factor, and apply a
|
// Use the largest of the two changes for the delta factor, and apply a
|
||||||
// significance shaping function to it.
|
// significance shaping function to it.
|
||||||
return clampF(angleChange*2.0f, gainChange*2.0f, 1.0f);
|
return clampf(angleChange*2.0f, gainChange*2.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculates static HRIR coefficients and delays for the given polar
|
// Calculates static HRIR coefficients and delays for the given polar
|
||||||
@ -223,7 +223,7 @@ ALuint GetMovingHrtfCoeffs(ALfloat elevation, ALfloat azimuth, ALfloat gain, ALf
|
|||||||
ridx[3] = evOffset[evidx[1]] + ((azCount[evidx[1]]-azidx[1]) % azCount[evidx[1]]);
|
ridx[3] = evOffset[evidx[1]] + ((azCount[evidx[1]]-azidx[1]) % azCount[evidx[1]]);
|
||||||
|
|
||||||
// Calculate the stepping parameters.
|
// Calculate the stepping parameters.
|
||||||
delta = maxF(floor(delta*(Hrtf.sampleRate*0.015f) + 0.5), 1.0f);
|
delta = maxf(floor(delta*(Hrtf.sampleRate*0.015f) + 0.5), 1.0f);
|
||||||
step = 1.0f / delta;
|
step = 1.0f / delta;
|
||||||
|
|
||||||
// Calculate the normalized and attenuated target HRIR coefficients using
|
// Calculate the normalized and attenuated target HRIR coefficients using
|
||||||
|
@ -127,12 +127,12 @@ enum DistanceModel {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static __inline ALfloat minF(ALfloat a, ALfloat b)
|
static __inline ALfloat minf(ALfloat a, ALfloat b)
|
||||||
{ return ((a > b) ? b : a); }
|
{ return ((a > b) ? b : a); }
|
||||||
static __inline ALfloat maxF(ALfloat a, ALfloat b)
|
static __inline ALfloat maxf(ALfloat a, ALfloat b)
|
||||||
{ return ((a > b) ? a : b); }
|
{ return ((a > b) ? a : b); }
|
||||||
static __inline ALfloat clampF(ALfloat val, ALfloat mn, ALfloat mx)
|
static __inline ALfloat clampf(ALfloat val, ALfloat min, ALfloat max)
|
||||||
{ return minF(mx, maxF(mn, val)); }
|
{ return minf(max, maxf(min, val)); }
|
||||||
|
|
||||||
static __inline ALuint minu(ALuint a, ALuint b)
|
static __inline ALuint minu(ALuint a, ALuint b)
|
||||||
{ return ((a > b) ? b : a); }
|
{ return ((a > b) ? b : a); }
|
||||||
|
@ -387,7 +387,7 @@ ALfloat lpCoeffCalc(ALfloat g, ALfloat cw)
|
|||||||
* head towards 1, which will flatten the signal */
|
* head towards 1, which will flatten the signal */
|
||||||
if(g < 0.9999f) /* 1-epsilon */
|
if(g < 0.9999f) /* 1-epsilon */
|
||||||
{
|
{
|
||||||
g = maxF(g, 0.01f);
|
g = maxf(g, 0.01f);
|
||||||
a = (1 - g*cw - aluSqrt(2*g*(1-cw) - g*g*(1 - cw*cw))) /
|
a = (1 - g*cw - aluSqrt(2*g*(1-cw) - g*g*(1 - cw*cw))) /
|
||||||
(1 - g);
|
(1 - g);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user