diff options
author | Chris Robinson <[email protected]> | 2020-06-15 18:50:59 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-06-15 20:21:54 -0700 |
commit | bd0144065a343c936b6a12be6e546e114575217b (patch) | |
tree | 391a13f7bf6d71e228c30da12e75af8432a787da /alc/backends/winmm.cpp | |
parent | c142b49981b57bdd50f20b6e916ead92ca9f044d (diff) |
Set channel labels from WFX channel masks
Diffstat (limited to 'alc/backends/winmm.cpp')
-rw-r--r-- | alc/backends/winmm.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/alc/backends/winmm.cpp b/alc/backends/winmm.cpp index e1261969..4dd74705 100644 --- a/alc/backends/winmm.cpp +++ b/alc/backends/winmm.cpp @@ -28,6 +28,7 @@ #include <windows.h> #include <mmsystem.h> +#include <mmreg.h> #include <array> #include <atomic> @@ -263,7 +264,7 @@ bool WinMMPlayback::reset() { mDevice->BufferSize = static_cast<ALuint>(uint64_t{mDevice->BufferSize} * mFormat.nSamplesPerSec / mDevice->Frequency); - mDevice->BufferSize = (mDevice->BufferSize+3) & ~0x3; + mDevice->BufferSize = (mDevice->BufferSize+3) & ~0x3u; mDevice->UpdateSize = mDevice->BufferSize / 4; mDevice->Frequency = mFormat.nSamplesPerSec; @@ -295,16 +296,23 @@ bool WinMMPlayback::reset() return false; } + ALuint chanmask{}; if(mFormat.nChannels == 2) + { mDevice->FmtChans = DevFmtStereo; + chanmask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT; + } else if(mFormat.nChannels == 1) + { mDevice->FmtChans = DevFmtMono; + chanmask = SPEAKER_FRONT_CENTER; + } else { ERR("Unhandled channel count: %d\n", mFormat.nChannels); return false; } - setDefaultWFXChannelOrder(); + setChannelOrderFromWFXMask(chanmask); ALuint BufferSize{mDevice->UpdateSize * mDevice->frameSizeFromFmt()}; |