https://bugs.winehq.org/show_bug.cgi?id=42546
--- Comment #12 from Huw Davies huw@codeweavers.com --- (In reply to Ivan_83 from comment #11)
But mixer module need more checks. I m move up check in DSOUND_PerformMix() if (maxq > device->buflen) maxq = device->buflen; and then make a test: set new_buflen = sizeof(float) * (max(aclen, (3 * fraglen)) / wfx->nBlockAlign); and got small noises and crash on exit.
The problem with this is that maxq corresponds to bytes in the audio client buffer, while buflen is bytes in the float buffer, so you're not comparing like with like.
I've sent in four patches which tidy this up by using frame counts. The final one of them fixes an issue with the initial assignment of maxq (now called 'frames').