aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/echo.c
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/effects/echo.c')
-rw-r--r--Alc/effects/echo.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Alc/effects/echo.c b/Alc/effects/echo.c
index 3d538d9d..cd556f1a 100644
--- a/Alc/effects/echo.c
+++ b/Alc/effects/echo.c
@@ -91,9 +91,10 @@ static ALboolean ALechoState_deviceUpdate(ALechoState *state, ALCdevice *Device)
// Use the next power of 2 for the buffer length, so the tap offsets can be
// wrapped using a mask instead of a modulo
- maxlen = fastf2i(AL_ECHO_MAX_DELAY * Device->Frequency) + 1;
- maxlen += fastf2i(AL_ECHO_MAX_LRDELAY * Device->Frequency) + 1;
- maxlen = NextPowerOf2(maxlen);
+ maxlen = fastf2i(AL_ECHO_MAX_DELAY*Device->Frequency + 0.5f) +
+ fastf2i(AL_ECHO_MAX_LRDELAY*Device->Frequency + 0.5f);
+ maxlen = NextPowerOf2(maxlen);
+ if(maxlen <= 0) return AL_FALSE;
if(maxlen != state->BufferLength)
{