From: Andrew Eikum Subject: Re: [PATCH v3 2/2] winmm: Buffer any WOM_DONE/WIM_DATA events triggered from within a waveOut/waveIn callback. Message-Id: <20220124205622.GW389@foghorn.codeweavers.com> Date: Mon, 24 Jan 2022 14:56:23 -0600 In-Reply-To: <20220121043727.302445-2-liampm32@gmail.com> References: <20220121043727.302445-1-liampm32@gmail.com> <20220121043727.302445-2-liampm32@gmail.com> On Fri, Jan 21, 2022 at 03:37:27PM +1100, Liam Murphy wrote: > The events are then fired after the callback completes. > I think a simpler way to solve this is to only process audio data during waveOutWrite if the device is stopped, see below patch. This should prevent us sending reentrant WOM_DONE messages. Can you try it out and see if that fixes your game? --- dlls/winmm/waveform.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dlls/winmm/waveform.c b/dlls/winmm/waveform.c index 1159b48b483..2813f9a103f 100644 --- a/dlls/winmm/waveform.c +++ b/dlls/winmm/waveform.c @@ -1948,11 +1948,10 @@ static MMRESULT WINMM_BeginPlaying(WINMM_Device *device) · TRACE("(%p)\n", device->handle); · - if(device->render) - /* prebuffer data before starting */ - WOD_PushData(device); - if(device->stopped){ + if(device->render) + WOD_PushData(device); + device->stopped = FALSE; · hr = IAudioClient_Start(device->client); --· 2.34.1