diff options
author | Chris Robinson <[email protected]> | 2019-06-27 09:47:31 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-06-27 09:47:31 -0700 |
commit | 2598ee6f0a1d8c81b5b023e617d72934284ac9d7 (patch) | |
tree | 5c58f1954d398f5455df0290368b10e8f89c9521 /Alc | |
parent | 341c68c9a124b41b40294d73f83e96768b5e7097 (diff) |
Properly set extra fields in MakeExtensible
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/backends/wasapi.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
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<const WAVEFORMATEXTENSIBLE&>(*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) |