diff options
author | Chris Robinson <[email protected]> | 2020-07-12 18:51:10 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-07-23 09:03:47 -0700 |
commit | 91df03f7eb309cd7d34ebab95e67e18438d25c0c (patch) | |
tree | 6f446608b852d9bdec921ba40cadfaed34c85651 /alc/voice.cpp | |
parent | 4817d8218541c594d1d996a7d7e009eddab19e40 (diff) |
Simplify mixer buffer size saturation handling
Diffstat (limited to 'alc/voice.cpp')
-rw-r--r-- | alc/voice.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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<ALuint>(minu64(DataSize64, - BUFFERSIZE + MAX_RESAMPLER_PADDING + 1)); - if(SrcBufferSize > BUFFERSIZE + MAX_RESAMPLER_PADDING) + if(DataSize64 <= BUFFERSIZE + MAX_RESAMPLER_PADDING) + SrcBufferSize = static_cast<ALuint>(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<<FRACTIONBITS) - DataPosFrac) / increment; if(DataSize64 < DstBufferSize) |