From 91df03f7eb309cd7d34ebab95e67e18438d25c0c Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 12 Jul 2020 18:51:10 -0700 Subject: Simplify mixer buffer size saturation handling --- alc/voice.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'alc/voice.cpp') diff --git a/alc/voice.cpp b/alc/voice.cpp index 266a38c4..e98e91ed 100644 --- a/alc/voice.cpp +++ b/alc/voice.cpp @@ -654,15 +654,15 @@ void Voice::mix(const State vstate, ALCcontext *Context, const ALuint SamplesToD DataSize64 = (DataSize64*increment + DataPosFrac) >> FRACTIONBITS; DataSize64 += MAX_RESAMPLER_PADDING; - SrcBufferSize = static_cast(minu64(DataSize64, - BUFFERSIZE + MAX_RESAMPLER_PADDING + 1)); - if(SrcBufferSize > BUFFERSIZE + MAX_RESAMPLER_PADDING) + if(DataSize64 <= BUFFERSIZE + MAX_RESAMPLER_PADDING) + SrcBufferSize = static_cast(DataSize64); + else { - SrcBufferSize = BUFFERSIZE + MAX_RESAMPLER_PADDING; /* If the source size got saturated, we can't fill the desired - * dst size. Figure out how many samples we can actually mix - * from this. + * dst size. Figure out how many samples we can actually mix. */ + SrcBufferSize = BUFFERSIZE + MAX_RESAMPLER_PADDING; + DataSize64 = SrcBufferSize - MAX_RESAMPLER_PADDING; DataSize64 = ((DataSize64<