aboutsummaryrefslogtreecommitdiffstats
path: root/alc/effects/echo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'alc/effects/echo.cpp')
-rw-r--r--alc/effects/echo.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/alc/effects/echo.cpp b/alc/effects/echo.cpp
index 47c0fedb..a9213df5 100644
--- a/alc/effects/echo.cpp
+++ b/alc/effects/echo.cpp
@@ -66,10 +66,12 @@ struct EchoState final : public EffectState {
ALboolean EchoState::deviceUpdate(const ALCdevice *Device)
{
+ const auto frequency = static_cast<float>(Device->Frequency);
+
// Use the next power of 2 for the buffer length, so the tap offsets can be
// wrapped using a mask instead of a modulo
- const ALuint maxlen{NextPowerOf2(float2uint(AL_ECHO_MAX_DELAY*Device->Frequency + 0.5f) +
- float2uint(AL_ECHO_MAX_LRDELAY*Device->Frequency + 0.5f))};
+ const ALuint maxlen{NextPowerOf2(float2uint(AL_ECHO_MAX_DELAY*frequency + 0.5f) +
+ float2uint(AL_ECHO_MAX_LRDELAY*frequency + 0.5f))};
if(maxlen != mSampleBuffer.size())
{
mSampleBuffer.resize(maxlen);