From 6027ac4bc247bb2b7b963561edfce0fce9c0e3a1 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 24 May 2022 01:30:01 -0700 Subject: Avoid dividing by a constant --- alc/effects/reverb.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'alc/effects') 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 / 2.0f}; + constexpr float mod_scale{al::numbers::pi_v * 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(idx&MOD_FRACMASK) / inv_scale)}; + const float lfo{std::sin(static_cast(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 / 2.0f}; + constexpr float mod_scale{al::numbers::pi_v * 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(idx&MOD_FRACMASK) / inv_scale)}; + const float lfo{std::sin(static_cast(idx&MOD_FRACMASK) * mod_scale)}; ModDelays[i] = (lfo+1.0f) * (depth + depthStep*fadeCount); } Index = idx; -- cgit v1.2.3