From 35a0f2665f834c107e39ec2dcfc3d9ae0a0b33ce Mon Sep 17 00:00:00 2001 From: Chris Robinson <chris.kcat@gmail.com> Date: Wed, 31 Mar 2021 09:37:30 -0700 Subject: Decode UHJ buffers to B-Format for mixing This should also have an adjustment for the shelf filter. Although it's not clear what the appropriate adjustments should be. --- al/buffer.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'al/buffer.cpp') diff --git a/al/buffer.cpp b/al/buffer.cpp index f63d5c71..436be9ae 100644 --- a/al/buffer.cpp +++ b/al/buffer.cpp @@ -51,7 +51,9 @@ #include "atomic.h" #include "core/except.h" #include "inprogext.h" +#include "core/logging.h" #include "opthelpers.h" +#include "voice.h" namespace { @@ -503,7 +505,7 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size, unpackalign, NameFromUserFmtType(SrcType)); const ALuint ambiorder{(DstChannels == FmtBFormat2D || DstChannels == FmtBFormat3D) ? - ALBuf->UnpackAmbiOrder : 0}; + ALBuf->UnpackAmbiOrder : ((DstChannels == FmtUHJ2) ? 1 : 0)}; if((access&AL_PRESERVE_DATA_BIT_SOFT)) { @@ -646,10 +648,11 @@ void PrepareCallback(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, SETERR_RETURN(context, AL_INVALID_ENUM,, "Unsupported callback format"); const ALuint ambiorder{(DstChannels == FmtBFormat2D || DstChannels == FmtBFormat3D) ? - ALBuf->UnpackAmbiOrder : 0}; + ALBuf->UnpackAmbiOrder : ((DstChannels == FmtUHJ2) ? 1 : 0)}; + constexpr uint line_size{BufferLineSize + MaxPostVoiceLoad}; al::vector<al::byte,16>(FrameSizeFromFmt(DstChannels, DstType, ambiorder) * - size_t{BufferLineSize + (MaxResamplerPadding>>1)}).swap(ALBuf->mData); + size_t{line_size}).swap(ALBuf->mData); ALBuf->mCallback = callback; ALBuf->mUserData = userptr; -- cgit v1.2.3