diff options
author | Chris Robinson <[email protected]> | 2020-04-03 02:48:35 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-04-03 02:48:35 -0700 |
commit | 8adbde90f5f1384c6ae2b75eb96e5ec6c14842de (patch) | |
tree | 23086ac51081b9c1150be7e6936fcaf516ebae84 /alc/mixer | |
parent | 367d4af07c61b3d0e705cfc10f4840647c92b026 (diff) |
Jump to the target gain if the fade amount is small
Diffstat (limited to 'alc/mixer')
-rw-r--r-- | alc/mixer/mixer_c.cpp | 6 | ||||
-rw-r--r-- | alc/mixer/mixer_neon.cpp | 6 | ||||
-rw-r--r-- | alc/mixer/mixer_sse.cpp | 6 |
3 files changed, 12 insertions, 6 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; diff --git a/alc/mixer/mixer_neon.cpp b/alc/mixer/mixer_neon.cpp index 092958b0..9048e30b 100644 --- a/alc/mixer/mixer_neon.cpp +++ b/alc/mixer/mixer_neon.cpp @@ -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; diff --git a/alc/mixer/mixer_sse.cpp b/alc/mixer/mixer_sse.cpp index 58e9c76b..6dcdbf3e 100644 --- a/alc/mixer/mixer_sse.cpp +++ b/alc/mixer/mixer_sse.cpp @@ -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; |