aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-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)