aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--al/buffer.cpp13
-rw-r--r--al/buffer.h1
-rw-r--r--al/source.cpp6
-rw-r--r--alc/alu.cpp8
-rw-r--r--alc/buffer_storage.cpp1
-rw-r--r--alc/buffer_storage.h1
-rw-r--r--alc/effects/convolution.cpp3
-rw-r--r--alc/inprogext.h3
-rw-r--r--alc/voice.cpp6
9 files changed, 30 insertions, 12 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;
diff --git a/alc/alu.cpp b/alc/alu.cpp
index 86cbefa5..7e6d6ca6 100644
--- a/alc/alu.cpp
+++ b/alc/alu.cpp
@@ -790,13 +790,14 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con
case FmtBFormat2D:
case FmtBFormat3D:
case FmtUHJ2:
+ case FmtUHJ3:
DirectChannels = DirectMode::Off;
break;
}
voice->mFlags &= ~(VoiceHasHrtf | VoiceHasNfc);
if(voice->mFmtChannels == FmtBFormat2D || voice->mFmtChannels == FmtBFormat3D
- || voice->mFmtChannels == FmtUHJ2)
+ || voice->mFmtChannels == FmtUHJ2 || voice->mFmtChannels == FmtUHJ3)
{
/* Special handling for B-Format sources. */
@@ -900,7 +901,8 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con
* whether input is 2D or 3D.
*/
const uint8_t *index_map{
- (voice->mFmtChannels == FmtBFormat2D || voice->mFmtChannels == FmtUHJ2) ?
+ (voice->mFmtChannels == FmtBFormat2D || voice->mFmtChannels == FmtUHJ2
+ || voice->mFmtChannels == FmtUHJ3) ?
GetAmbi2DLayout(voice->mAmbiLayout).data() :
GetAmbiLayout(voice->mAmbiLayout).data()};
@@ -1558,7 +1560,7 @@ void CalcSourceParams(Voice *voice, ALCcontext *context, bool force)
if((voice->mProps.DirectChannels != DirectMode::Off && voice->mFmtChannels != FmtMono
&& voice->mFmtChannels != FmtBFormat2D && voice->mFmtChannels != FmtBFormat3D
- && voice->mFmtChannels != FmtUHJ2)
+ && voice->mFmtChannels != FmtUHJ2 && voice->mFmtChannels != FmtUHJ3)
|| voice->mProps.mSpatializeMode==SpatializeMode::Off
|| (voice->mProps.mSpatializeMode==SpatializeMode::Auto && voice->mFmtChannels != FmtMono))
CalcNonAttnSourceParams(voice, &voice->mProps, context);
diff --git a/alc/buffer_storage.cpp b/alc/buffer_storage.cpp
index 58752341..1e35220a 100644
--- a/alc/buffer_storage.cpp
+++ b/alc/buffer_storage.cpp
@@ -34,6 +34,7 @@ uint ChannelsFromFmt(FmtChannels chans, uint ambiorder) noexcept
case FmtBFormat2D: return (ambiorder*2) + 1;
case FmtBFormat3D: return (ambiorder+1) * (ambiorder+1);
case FmtUHJ2: return 2;
+ case FmtUHJ3: return 3;
}
return 0;
}
diff --git a/alc/buffer_storage.h b/alc/buffer_storage.h
index 2f8da5e2..135b9b83 100644
--- a/alc/buffer_storage.h
+++ b/alc/buffer_storage.h
@@ -28,6 +28,7 @@ enum FmtChannels : unsigned char {
FmtBFormat2D,
FmtBFormat3D,
FmtUHJ2, /* 2-channel UHJ, aka "BHJ", stereo-compatible */
+ FmtUHJ3, /* 3-channel UHJ, aka "THJ", first-two channels are stereo-compatible */
};
enum class AmbiLayout : unsigned char {
diff --git a/alc/effects/convolution.cpp b/alc/effects/convolution.cpp
index d03d661f..1ee59604 100644
--- a/alc/effects/convolution.cpp
+++ b/alc/effects/convolution.cpp
@@ -382,7 +382,7 @@ void ConvolutionState::update(const ALCcontext *context, const EffectSlot *slot,
* Not that UHJ should really ever be used for convolution, but it's a
* valid format regardless.
*/
- if(mChannels == FmtUHJ2 && target.RealOut
+ if((mChannels == FmtUHJ2 || mChannels == FmtUHJ3) && target.RealOut
&& target.RealOut->ChannelIndex[FrontLeft] != INVALID_CHANNEL_INDEX
&& target.RealOut->ChannelIndex[FrontRight] != INVALID_CHANNEL_INDEX)
{
@@ -435,6 +435,7 @@ void ConvolutionState::update(const ALCcontext *context, const EffectSlot *slot,
case FmtBFormat2D:
case FmtBFormat3D:
case FmtUHJ2:
+ case FmtUHJ3:
break;
}
diff --git a/alc/inprogext.h b/alc/inprogext.h
index a3319ff7..4f9c6715 100644
--- a/alc/inprogext.h
+++ b/alc/inprogext.h
@@ -81,6 +81,9 @@ ALCboolean ALC_APIENTRY alcReopenDeviceSOFT(ALCdevice *device, const ALCchar *de
#define AL_FORMAT_UHJ2CHN8 0x19A2
#define AL_FORMAT_UHJ2CHN16 0x19A3
#define AL_FORMAT_UHJ2CHN_FLOAT32 0x19A4
+#define AL_FORMAT_UHJ3CHN8 0x19A5
+#define AL_FORMAT_UHJ3CHN16 0x19A6
+#define AL_FORMAT_UHJ3CHN_FLOAT32 0x19A7
#endif
#ifdef __cplusplus
diff --git a/alc/voice.cpp b/alc/voice.cpp
index c3e3dca2..577d5f72 100644
--- a/alc/voice.cpp
+++ b/alc/voice.cpp
@@ -529,7 +529,7 @@ void Voice::mix(const State vstate, ALCcontext *Context, const uint SamplesToDo)
Counter = std::min(Counter, 64u);
const uint PostPadding{MaxResamplerEdge +
- ((mFmtChannels==FmtUHJ2) ? uint{UhjDecoder::sFilterDelay} : 0u)};
+ ((mFmtChannels==FmtUHJ2 || mFmtChannels==FmtUHJ3) ? uint{UhjDecoder::sFilterDelay} : 0u)};
uint buffers_done{0u};
uint OutPos{0u};
do {
@@ -823,9 +823,9 @@ void Voice::mix(const State vstate, ALCcontext *Context, const uint SamplesToDo)
void Voice::prepare(ALCdevice *device)
{
- if(mFmtChannels == FmtUHJ2 && !mDecoder)
+ if((mFmtChannels == FmtUHJ2 || mFmtChannels == FmtUHJ3) && !mDecoder)
mDecoder = std::make_unique<UhjDecoder>();
- else if(mFmtChannels != FmtUHJ2)
+ else if(mFmtChannels != FmtUHJ2 && mFmtChannels != FmtUHJ3)
mDecoder = nullptr;
/* Clear the stepping value explicitly so the mixer knows not to mix this