aboutsummaryrefslogtreecommitdiffstats
path: root/al
diff options
context:
space:
mode:
Diffstat (limited to 'al')
-rw-r--r--al/buffer.cpp13
-rw-r--r--al/buffer.h1
-rw-r--r--al/source.cpp6
3 files changed, 15 insertions, 5 deletions
diff --git a/al/buffer.cpp b/al/buffer.cpp
index 436be9ae..23020559 100644
--- a/al/buffer.cpp
+++ b/al/buffer.cpp
@@ -274,6 +274,7 @@ ALuint ChannelsFromUserFmt(UserFmtChannels chans, ALuint ambiorder) noexcept
case UserFmtBFormat2D: return (ambiorder*2) + 1;
case UserFmtBFormat3D: return (ambiorder+1) * (ambiorder+1);
case UserFmtUHJ2: return 2;
+ case UserFmtUHJ3: return 3;
}
return 0;
}
@@ -469,6 +470,7 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size,
case UserFmtBFormat2D: DstChannels = FmtBFormat2D; break;
case UserFmtBFormat3D: DstChannels = FmtBFormat3D; break;
case UserFmtUHJ2: DstChannels = FmtUHJ2; break;
+ case UserFmtUHJ3: DstChannels = FmtUHJ3; break;
}
if UNLIKELY(static_cast<long>(SrcChannels) != static_cast<long>(DstChannels))
SETERR_RETURN(context, AL_INVALID_ENUM, , "Invalid format");
@@ -505,7 +507,7 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size,
unpackalign, NameFromUserFmtType(SrcType));
const ALuint ambiorder{(DstChannels == FmtBFormat2D || DstChannels == FmtBFormat3D) ?
- ALBuf->UnpackAmbiOrder : ((DstChannels == FmtUHJ2) ? 1 : 0)};
+ ALBuf->UnpackAmbiOrder : ((DstChannels == FmtUHJ2 || DstChannels == FmtUHJ3) ? 1 : 0)};
if((access&AL_PRESERVE_DATA_BIT_SOFT))
{
@@ -627,6 +629,7 @@ void PrepareCallback(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq,
case UserFmtBFormat2D: DstChannels = FmtBFormat2D; break;
case UserFmtBFormat3D: DstChannels = FmtBFormat3D; break;
case UserFmtUHJ2: DstChannels = FmtUHJ2; break;
+ case UserFmtUHJ3: DstChannels = FmtUHJ3; break;
}
if UNLIKELY(static_cast<long>(SrcChannels) != static_cast<long>(DstChannels))
SETERR_RETURN(context, AL_INVALID_ENUM,, "Invalid format");
@@ -648,7 +651,7 @@ 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 : ((DstChannels == FmtUHJ2) ? 1 : 0)};
+ ALBuf->UnpackAmbiOrder : ((DstChannels == FmtUHJ2 || DstChannels == FmtUHJ3) ? 1 : 0)};
constexpr uint line_size{BufferLineSize + MaxPostVoiceLoad};
al::vector<al::byte,16>(FrameSizeFromFmt(DstChannels, DstType, ambiorder) *
@@ -681,7 +684,7 @@ al::optional<DecompResult> DecomposeUserFormat(ALenum format)
UserFmtChannels channels;
UserFmtType type;
};
- static const std::array<FormatMap,49> UserFmtList{{
+ static const std::array<FormatMap,52> UserFmtList{{
{ AL_FORMAT_MONO8, UserFmtMono, UserFmtUByte },
{ AL_FORMAT_MONO16, UserFmtMono, UserFmtShort },
{ AL_FORMAT_MONO_FLOAT32, UserFmtMono, UserFmtFloat },
@@ -741,6 +744,10 @@ al::optional<DecompResult> DecomposeUserFormat(ALenum format)
{ AL_FORMAT_UHJ2CHN8, UserFmtUHJ2, UserFmtUByte },
{ AL_FORMAT_UHJ2CHN16, UserFmtUHJ2, UserFmtShort },
{ AL_FORMAT_UHJ2CHN_FLOAT32, UserFmtUHJ2, UserFmtFloat },
+
+ { AL_FORMAT_UHJ3CHN8, UserFmtUHJ3, UserFmtUByte },
+ { AL_FORMAT_UHJ3CHN16, UserFmtUHJ3, UserFmtShort },
+ { AL_FORMAT_UHJ3CHN_FLOAT32, UserFmtUHJ3, UserFmtFloat },
}};
for(const auto &fmt : UserFmtList)
diff --git a/al/buffer.h b/al/buffer.h
index cef9b5d8..47729cbe 100644
--- a/al/buffer.h
+++ b/al/buffer.h
@@ -36,6 +36,7 @@ enum UserFmtChannels : unsigned char {
UserFmtBFormat2D = FmtBFormat2D,
UserFmtBFormat3D = FmtBFormat3D,
UserFmtUHJ2 = FmtUHJ2,
+ UserFmtUHJ3 = FmtUHJ3,
};
diff --git a/al/source.cpp b/al/source.cpp
index dd9e6cc7..6d56549a 100644
--- a/al/source.cpp
+++ b/al/source.cpp
@@ -444,8 +444,10 @@ void InitVoice(Voice *voice, ALsource *source, ALbufferQueueItem *BufferList, AL
voice->mFmtChannels = buffer->mChannels;
voice->mFmtType = buffer->mType;
voice->mFrameSize = buffer->frameSizeFromFmt();
- voice->mAmbiLayout = (buffer->mChannels==FmtUHJ2) ? AmbiLayout::FuMa : buffer->mAmbiLayout;
- voice->mAmbiScaling = (buffer->mChannels==FmtUHJ2) ? AmbiScaling::FuMa : buffer->mAmbiScaling;
+ voice->mAmbiLayout = (buffer->mChannels==FmtUHJ2 || buffer->mChannels==FmtUHJ3) ?
+ AmbiLayout::FuMa : buffer->mAmbiLayout;
+ voice->mAmbiScaling = (buffer->mChannels==FmtUHJ2 || buffer->mChannels==FmtUHJ3) ?
+ AmbiScaling::FuMa : buffer->mAmbiScaling;
voice->mAmbiOrder = buffer->mAmbiOrder;
if(buffer->mCallback) voice->mFlags |= VoiceIsCallback;