From 2598ee6f0a1d8c81b5b023e617d72934284ac9d7 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 27 Jun 2019 09:47:31 -0700 Subject: Properly set extra fields in MakeExtensible --- Alc/backends/wasapi.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Alc/backends/wasapi.cpp b/Alc/backends/wasapi.cpp index 976af0d0..db4b5e4e 100644 --- a/Alc/backends/wasapi.cpp +++ b/Alc/backends/wasapi.cpp @@ -305,12 +305,14 @@ bool MakeExtensible(WAVEFORMATEXTENSIBLE *out, const WAVEFORMATEX *in) *out = WAVEFORMATEXTENSIBLE{}; if(in->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { - *out = reinterpret_cast(*in); + *out = *CONTAINING_RECORD(in, const WAVEFORMATEXTENSIBLE, Format); out->Format.cbSize = sizeof(*out) - sizeof(out->Format); } else if(in->wFormatTag == WAVE_FORMAT_PCM) { out->Format = *in; + out->Format.cbSize = 0; + out->Samples.wValidBitsPerSample = out->Format.wBitsPerSample; if(out->Format.nChannels == 1) out->dwChannelMask = MONO; else if(out->Format.nChannels == 2) @@ -322,6 +324,8 @@ bool MakeExtensible(WAVEFORMATEXTENSIBLE *out, const WAVEFORMATEX *in) else if(in->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) { out->Format = *in; + out->Format.cbSize = 0; + out->Samples.wValidBitsPerSample = out->Format.wBitsPerSample; if(out->Format.nChannels == 1) out->dwChannelMask = MONO; else if(out->Format.nChannels == 2) -- cgit v1.2.3