diff options
author | Chris Robinson <[email protected]> | 2020-05-12 04:45:25 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-05-12 04:45:25 -0700 |
commit | 2f8f829772305c47a495f7197a44a836b1e3f7cb (patch) | |
tree | d8c658d5304259d5783ff6e424eb9dd7e0071715 | |
parent | 3ce8a9914cddd6c050b2be65cd7f36b31010a4cd (diff) |
Properly count the last number of samples to mix
-rw-r--r-- | alc/mixer/mixer_neon.cpp | 3 | ||||
-rw-r--r-- | alc/mixer/mixer_sse.cpp | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/alc/mixer/mixer_neon.cpp b/alc/mixer/mixer_neon.cpp index 2cf7e2e8..9d21b1c5 100644 --- a/alc/mixer/mixer_neon.cpp +++ b/alc/mixer/mixer_neon.cpp @@ -219,6 +219,7 @@ void Mix_<NEONTag>(const al::span<const float> InSamples, const al::span<FloatBu const float delta{(Counter > 0) ? 1.0f / static_cast<float>(Counter) : 0.0f}; const auto min_len = minz(Counter, InSamples.size()); const auto aligned_len = minz((min_len+3) & ~size_t{3}, InSamples.size()) - min_len; + for(FloatBufferLine &output : OutBuffer) { float *RESTRICT dst{al::assume_aligned<16>(output.data()+OutPos)}; @@ -288,7 +289,7 @@ void Mix_<NEONTag>(const al::span<const float> InSamples, const al::span<FloatBu pos += 4; } while(--todo); } - for(size_t leftover{InSamples.size()&3};leftover;++pos,--leftover) + for(size_t leftover{(InSamples.size()-pos)&3};leftover;++pos,--leftover) dst[pos] += InSamples[pos] * gain; } } diff --git a/alc/mixer/mixer_sse.cpp b/alc/mixer/mixer_sse.cpp index c28484a5..d2e021ff 100644 --- a/alc/mixer/mixer_sse.cpp +++ b/alc/mixer/mixer_sse.cpp @@ -193,6 +193,7 @@ void Mix_<SSETag>(const al::span<const float> InSamples, const al::span<FloatBuf const float delta{(Counter > 0) ? 1.0f / static_cast<float>(Counter) : 0.0f}; const auto min_len = minz(Counter, InSamples.size()); const auto aligned_len = minz((min_len+3) & ~size_t{3}, InSamples.size()) - min_len; + for(FloatBufferLine &output : OutBuffer) { float *RESTRICT dst{al::assume_aligned<16>(output.data()+OutPos)}; @@ -261,7 +262,7 @@ void Mix_<SSETag>(const al::span<const float> InSamples, const al::span<FloatBuf pos += 4; } while(--todo); } - for(size_t leftover{InSamples.size()&3};leftover;++pos,--leftover) + for(size_t leftover{(InSamples.size()-pos)&3};leftover;++pos,--leftover) dst[pos] += InSamples[pos] * gain; } } |