diff options
Diffstat (limited to 'al')
-rw-r--r-- | al/buffer.cpp | 12 | ||||
-rw-r--r-- | al/source.cpp | 9 |
2 files changed, 7 insertions, 14 deletions
diff --git a/al/buffer.cpp b/al/buffer.cpp index 550b6247..fe944ead 100644 --- a/al/buffer.cpp +++ b/al/buffer.cpp @@ -522,10 +522,8 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size, SETERR_RETURN(context, AL_INVALID_VALUE,, "Invalid unpack alignment %u for %s samples", unpackalign, NameFromUserFmtType(SrcType)); - const ALuint ambiorder{(*DstChannels == FmtBFormat2D || *DstChannels == FmtBFormat3D) ? - ALBuf->UnpackAmbiOrder : - ((*DstChannels == FmtUHJ2 || *DstChannels == FmtUHJ3 || *DstChannels == FmtUHJ4) ? 1 : - 0)}; + const ALuint ambiorder{IsBFormat(*DstChannels) ? ALBuf->UnpackAmbiOrder : + (IsUHJ(*DstChannels) ? 1 : 0)}; if((access&AL_PRESERVE_DATA_BIT_SOFT)) { @@ -643,10 +641,8 @@ void PrepareCallback(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, if UNLIKELY(!DstType) SETERR_RETURN(context, AL_INVALID_ENUM,, "Unsupported callback format"); - const ALuint ambiorder{(*DstChannels == FmtBFormat2D || *DstChannels == FmtBFormat3D) ? - ALBuf->UnpackAmbiOrder : - ((*DstChannels == FmtUHJ2 || *DstChannels == FmtUHJ3 || *DstChannels == FmtUHJ4) ? 1 : - 0)}; + const ALuint ambiorder{IsBFormat(*DstChannels) ? ALBuf->UnpackAmbiOrder : + (IsUHJ(*DstChannels) ? 1 : 0)}; constexpr uint line_size{BufferLineSize + MaxPostVoiceLoad}; al::vector<al::byte,16>(FrameSizeFromFmt(*DstChannels, *DstType, ambiorder) * diff --git a/al/source.cpp b/al/source.cpp index 7ba08970..d8584956 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -496,10 +496,8 @@ void InitVoice(Voice *voice, ALsource *source, ALbufferQueueItem *BufferList, AL voice->mFmtType = buffer->mType; voice->mNumChannels = buffer->channelsFromFmt(); voice->mFrameSize = buffer->frameSizeFromFmt(); - voice->mAmbiLayout = (buffer->mChannels == FmtUHJ2 || buffer->mChannels == FmtUHJ3 - || buffer->mChannels == FmtUHJ4) ? AmbiLayout::FuMa : buffer->mAmbiLayout; - voice->mAmbiScaling = (buffer->mChannels == FmtUHJ2 || buffer->mChannels == FmtUHJ3 - || buffer->mChannels == FmtUHJ4) ? AmbiScaling::UHJ : buffer->mAmbiScaling; + voice->mAmbiLayout = buffer->isUhj() ? AmbiLayout::FuMa : buffer->mAmbiLayout; + voice->mAmbiScaling = buffer->isUhj() ? AmbiScaling::UHJ : buffer->mAmbiScaling; voice->mAmbiOrder = buffer->mAmbiOrder; if(buffer->mCallback) voice->mFlags |= VoiceIsCallback; @@ -509,8 +507,7 @@ void InitVoice(Voice *voice, ALsource *source, ALbufferQueueItem *BufferList, AL /* Even if storing really high order ambisonics, we only mix channels for * orders up to MaxAmbiOrder. The rest are simply dropped. */ - ALuint num_channels{(buffer->mChannels == FmtUHJ2) ? 3 : - ChannelsFromFmt(buffer->mChannels, minu(buffer->mAmbiOrder, MaxAmbiOrder))}; + ALuint num_channels{buffer->mixerChannelsFromFmt()}; if UNLIKELY(num_channels > device->mSampleData.size()) { ERR("Unexpected channel count: %u (limit: %zu, %d:%d)\n", num_channels, |