Jinoh Kang (@iamahuman) commented about dlls/windows.media.speech/recognizer.c:
UINT32 count = 0;
events[count++] = impl->worker_control_event;
if (!paused) events[count++] = impl->audio_buf_event;
status = WaitForMultipleObjects(count, events, FALSE, INFINITE);
if (status == 0) /* worker_control_event signaled */
{
EnterCriticalSection(&impl->cs);
paused = impl->worker_paused;
running = impl->worker_running;
LeaveCriticalSection(&impl->cs);
if (old_paused < paused)
{
IAudioClient_Stop(impl->audio_client);
Note that `IAudioClient` may already have pending audio data in buffer at the time `IAudioClient_Stop` is called. Ideally `PauseAsync` should wait until the capture buffer is flushed, but let's skip that for this MR.