aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-09-29 19:39:49 -0700
committerChris Robinson <[email protected]>2018-09-29 19:39:49 -0700
commit7ad4f753a42a4ff9c4ce2be0a848f8aaccb86454 (patch)
tree05f99efd0d3a45869e1e64db08f9c06b82dbaf35
parentd5a78f0843571c55d9c7671c49c4b5a092ae951f (diff)
Fix some length ranges
-rw-r--r--Alc/mastering.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Alc/mastering.c b/Alc/mastering.c
index fb831f46..b92390bb 100644
--- a/Alc/mastering.c
+++ b/Alc/mastering.c
@@ -356,8 +356,14 @@ Compressor* CompressorInit(const ALuint NumChans, const ALuint SampleRate,
ALsizei hold;
size_t size;
- lookAhead = (ALsizei)clampf(roundf(LookAheadTime*SampleRate), 0.0f, BUFFERSIZE);
- hold = (ALsizei)clampf(roundf(HoldTime*SampleRate), 0.0f, BUFFERSIZE);
+ lookAhead = (ALsizei)clampf(roundf(LookAheadTime*SampleRate), 0.0f, BUFFERSIZE-1);
+ hold = (ALsizei)clampf(roundf(HoldTime*SampleRate), 0.0f, BUFFERSIZE-1);
+ /* The sliding hold implementation doesn't handle a length of 1. A 1-sample
+ * hold is useless anyway, it would only ever give back what was just given
+ * to it.
+ */
+ if(hold == 1)
+ hold = 0;
size = sizeof(*Comp);
if(lookAhead > 0)