In S_PaintChannels (snd_mix.c), there is a while loop that calls SND_PaintChannelFrom8/16. This while loop normally runs only once but it will execute twice when a looping sound wraps around. However, SND_PaintChannelFrom8/16 always writes into the paintbuffer starting at 0 - so when the sound wraps around, we incorrectly write onto the same part of the paintbuffer twice.
This patch fixes that by providing SND_PaintChannelFrom8/16 with the correct paintbuffer offset to write at.
Easiest way to hear this is in e1m1, listen to the looping wind sound at the top of the first lift, or the lift sound itself. Without the patch there's a 'popping' sound when the loops wrap around, with the patch the looping is seamless.
Thanks. This patch seems to be applied at r886, closing.