From f1c2800fa41b10d5c6f45208b1349f3503aed9c4 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 22:34:28 +0200 Subject: [PATCH] Don't do implicit memset --- audio/drivers/xaudio.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/audio/drivers/xaudio.c b/audio/drivers/xaudio.c index 76121dc1fe..de3b93a1b9 100644 --- a/audio/drivers/xaudio.c +++ b/audio/drivers/xaudio.c @@ -275,15 +275,23 @@ static size_t xaudio2_write(xaudio2_t *handle, const void *buf, size_t bytes_) if (handle->bufptr == handle->bufsize) { - XAUDIO2_BUFFER xa2buffer = {0}; + XAUDIO2_BUFFER xa2buffer; while (handle->buffers == MAX_BUFFERS - 1) WaitForSingleObject(handle->hEvent, INFINITE); + xa2buffer.Flags = 0; xa2buffer.AudioBytes = handle->bufsize; xa2buffer.pAudioData = handle->buf + handle->write_buffer * handle->bufsize; + xa2buffer.PlayBegin = 0; + xa2buffer.PlayLength = 0; + xa2buffer.LoopBegin = 0; + xa2buffer.LoopLength = 0; + xa2buffer.LoopCount = 0; + xa2buffer.pContext = NULL; - if (FAILED(IXAudio2SourceVoice_SubmitSourceBuffer(handle->pSourceVoice, &xa2buffer, NULL))) + if (FAILED(IXAudio2SourceVoice_SubmitSourceBuffer( + handle->pSourceVoice, &xa2buffer, NULL))) return 0; InterlockedIncrement((LONG volatile*)&handle->buffers);