Jump to the target gain if the fade amount is small

This commit is contained in:
Chris Robinson
2020-04-03 02:48:35 -07:00
parent 367d4af07c
commit 8adbde90f5
3 changed files with 12 additions and 6 deletions
+4 -2
View File
@@ -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;
+4 -2
View File
@@ -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;
+4 -2
View File
@@ -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;