aboutsummaryrefslogtreecommitdiffstats
path: root/alc/mixer/mixer_c.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-04-03 02:48:35 -0700
committerChris Robinson <[email protected]>2020-04-03 02:48:35 -0700
commit8adbde90f5f1384c6ae2b75eb96e5ec6c14842de (patch)
tree23086ac51081b9c1150be7e6936fcaf516ebae84 /alc/mixer/mixer_c.cpp
parent367d4af07c61b3d0e705cfc10f4840647c92b026 (diff)
Jump to the target gain if the fade amount is small
Diffstat (limited to 'alc/mixer/mixer_c.cpp')
-rw-r--r--alc/mixer/mixer_c.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/alc/mixer/mixer_c.cpp b/alc/mixer/mixer_c.cpp
index cdfc57d9..d169ce79 100644
--- a/alc/mixer/mixer_c.cpp
+++ b/alc/mixer/mixer_c.cpp
@@ -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;