Jump to the target gain if the fade amount is small
This commit is contained in:
@@ -162,7 +162,9 @@ void Mix_<CTag>(const al::span<const float> InSamples, const al::span<FloatBuffe
|
||||
const ALfloat diff{*TargetGains - gain};
|
||||
|
||||
auto in_iter = InSamples.begin();
|
||||
if(std::fabs(diff) > std::numeric_limits<float>::epsilon())
|
||||
if(!(std::fabs(diff) > std::numeric_limits<float>::epsilon()))
|
||||
gain = *TargetGains;
|
||||
else
|
||||
{
|
||||
const ALfloat step{diff * delta};
|
||||
ALfloat step_count{0.0f};
|
||||
@@ -175,8 +177,8 @@ void Mix_<CTag>(const al::span<const float> InSamples, const al::span<FloatBuffe
|
||||
gain = *TargetGains;
|
||||
else
|
||||
gain += step*step_count;
|
||||
*CurrentGains = gain;
|
||||
}
|
||||
*CurrentGains = gain;
|
||||
++CurrentGains;
|
||||
++TargetGains;
|
||||
|
||||
|
||||
@@ -224,7 +224,9 @@ void Mix_<NEONTag>(const al::span<const float> InSamples, const al::span<FloatBu
|
||||
const ALfloat diff{*TargetGains - gain};
|
||||
|
||||
auto in_iter = InSamples.begin();
|
||||
if(std::fabs(diff) > std::numeric_limits<float>::epsilon())
|
||||
if(!(std::fabs(diff) > std::numeric_limits<float>::epsilon()))
|
||||
gain = *TargetGains;
|
||||
else
|
||||
{
|
||||
const ALfloat step{diff * delta};
|
||||
ALfloat step_count{0.0f};
|
||||
@@ -264,12 +266,12 @@ void Mix_<NEONTag>(const al::span<const float> InSamples, const al::span<FloatBu
|
||||
gain = *TargetGains;
|
||||
else
|
||||
gain += step*step_count;
|
||||
*CurrentGains = gain;
|
||||
|
||||
/* Mix until pos is aligned with 4 or the mix is done. */
|
||||
while(in_iter != aligned_end)
|
||||
*(dst++) += *(in_iter++) * gain;
|
||||
}
|
||||
*CurrentGains = gain;
|
||||
++CurrentGains;
|
||||
++TargetGains;
|
||||
|
||||
|
||||
@@ -198,7 +198,9 @@ void Mix_<SSETag>(const al::span<const float> InSamples, const al::span<FloatBuf
|
||||
const ALfloat diff{*TargetGains - gain};
|
||||
|
||||
auto in_iter = InSamples.begin();
|
||||
if(std::fabs(diff) > std::numeric_limits<float>::epsilon())
|
||||
if(!(std::fabs(diff) > std::numeric_limits<float>::epsilon()))
|
||||
gain = *TargetGains;
|
||||
else
|
||||
{
|
||||
const ALfloat step{diff * delta};
|
||||
ALfloat step_count{0.0f};
|
||||
@@ -236,12 +238,12 @@ void Mix_<SSETag>(const al::span<const float> InSamples, const al::span<FloatBuf
|
||||
gain = *TargetGains;
|
||||
else
|
||||
gain += step*step_count;
|
||||
*CurrentGains = gain;
|
||||
|
||||
/* Mix until pos is aligned with 4 or the mix is done. */
|
||||
while(in_iter != aligned_end)
|
||||
*(dst++) += *(in_iter++) * gain;
|
||||
}
|
||||
*CurrentGains = gain;
|
||||
++CurrentGains;
|
||||
++TargetGains;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user