https://bugs.winehq.org/show_bug.cgi?id=40963
--- Comment #8 from Sebastian Lackner sebastian@fds-team.de --- (In reply to Andrew Eikum from comment #6)
Created attachment 55163 [details] xaudio2: Ignore queued AL buffers after Stop
I'm not thrilled with this patch, but I think it will fix it.
I wasn't able to find a way to remove buffers from the alSource before they're played. So instead we just ignore them as they're completed playing by OpenAL.
Based on Alistairs request I've added it to Wine Staging anyway. Please note that the patch attached here leads to compiler warnings (unused variables) and contains mistake in the handling of abandoned_albufs.
if(processed > src->abandoned_albufs){ processed -= src->abandoned_albufs; i = src->abandoned_albufs;
Setting i here has no effect.
src->abandoned_albufs = 0; src->first_al_buf += processed; src->first_al_buf %= XAUDIO2_MAX_QUEUED_BUFFERS; src->al_bufs_used -= processed; for(i = 0; i < processed; ++i){
This will iterate over the wrong range of buffers.
Those issues are fixed in the patch included in Wine Staging.