diff options
author | Chris Robinson <[email protected]> | 2022-05-24 01:30:01 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-05-24 02:20:33 -0700 |
commit | 6027ac4bc247bb2b7b963561edfce0fce9c0e3a1 (patch) | |
tree | f6ff1ea8f460fbc350af281d6cc0867c99ba94d6 /alc | |
parent | 074dbef2e3129e9f7ee4895c44721c2a0a4b045b (diff) |
Avoid dividing by a constant
Diffstat (limited to 'alc')
-rw-r--r-- | alc/effects/reverb.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp index 81c6f865..4510923b 100644 --- a/alc/effects/reverb.cpp +++ b/alc/effects/reverb.cpp @@ -1427,14 +1427,14 @@ void ReverbState::earlyFaded(const size_t offset, const size_t todo, const float void Modulation::calcDelays(size_t todo) { - constexpr float inv_scale{MOD_FRACONE / al::numbers::pi_v<float> / 2.0f}; + constexpr float mod_scale{al::numbers::pi_v<float> * 2.0f / MOD_FRACONE}; uint idx{Index}; const uint step{Step}; const float depth{Depth[0]}; for(size_t i{0};i < todo;++i) { idx += step; - const float lfo{std::sin(static_cast<float>(idx&MOD_FRACMASK) / inv_scale)}; + const float lfo{std::sin(static_cast<float>(idx&MOD_FRACMASK) * mod_scale)}; ModDelays[i] = (lfo+1.0f) * depth; } Index = idx; @@ -1442,7 +1442,7 @@ void Modulation::calcDelays(size_t todo) void Modulation::calcFadedDelays(size_t todo, float fadeCount, float fadeStep) { - constexpr float inv_scale{MOD_FRACONE / al::numbers::pi_v<float> / 2.0f}; + constexpr float mod_scale{al::numbers::pi_v<float> * 2.0f / MOD_FRACONE}; uint idx{Index}; const uint step{Step}; const float depth{Depth[0]}; @@ -1451,7 +1451,7 @@ void Modulation::calcFadedDelays(size_t todo, float fadeCount, float fadeStep) { fadeCount += 1.0f; idx += step; - const float lfo{std::sin(static_cast<float>(idx&MOD_FRACMASK) / inv_scale)}; + const float lfo{std::sin(static_cast<float>(idx&MOD_FRACMASK) * mod_scale)}; ModDelays[i] = (lfo+1.0f) * (depth + depthStep*fadeCount); } Index = idx; |