aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
Diffstat (limited to 'alc')
-rw-r--r--alc/alu.cpp7
-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.h15
-rw-r--r--alc/voice.cpp14
6 files changed, 27 insertions, 14 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp
index 7e6d6ca6..57cea740 100644
--- a/alc/alu.cpp
+++ b/alc/alu.cpp
@@ -791,13 +791,15 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con
case FmtBFormat3D:
case FmtUHJ2:
case FmtUHJ3:
+ case FmtUHJ4:
DirectChannels = DirectMode::Off;
break;
}
voice->mFlags &= ~(VoiceHasHrtf | VoiceHasNfc);
if(voice->mFmtChannels == FmtBFormat2D || voice->mFmtChannels == FmtBFormat3D
- || voice->mFmtChannels == FmtUHJ2 || voice->mFmtChannels == FmtUHJ3)
+ || voice->mFmtChannels == FmtUHJ2 || voice->mFmtChannels == FmtUHJ3
+ || voice->mFmtChannels == FmtUHJ4)
{
/* Special handling for B-Format sources. */
@@ -1560,7 +1562,8 @@ 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 != FmtUHJ3)
+ && voice->mFmtChannels != FmtUHJ2 && voice->mFmtChannels != FmtUHJ3
+ && 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 1e35220a..3eb1e28a 100644
--- a/alc/buffer_storage.cpp
+++ b/alc/buffer_storage.cpp
@@ -35,6 +35,7 @@ uint ChannelsFromFmt(FmtChannels chans, uint ambiorder) noexcept
case FmtBFormat3D: return (ambiorder+1) * (ambiorder+1);
case FmtUHJ2: return 2;
case FmtUHJ3: return 3;
+ case FmtUHJ4: return 4;
}
return 0;
}
diff --git a/alc/buffer_storage.h b/alc/buffer_storage.h
index 135b9b83..733a62e3 100644
--- a/alc/buffer_storage.h
+++ b/alc/buffer_storage.h
@@ -29,6 +29,7 @@ enum FmtChannels : unsigned char {
FmtBFormat3D,
FmtUHJ2, /* 2-channel UHJ, aka "BHJ", stereo-compatible */
FmtUHJ3, /* 3-channel UHJ, aka "THJ", first-two channels are stereo-compatible */
+ FmtUHJ4, /* 4-channel UHJ, aka "PHJ", first-two channels are stereo-compatible */
};
enum class AmbiLayout : unsigned char {
diff --git a/alc/effects/convolution.cpp b/alc/effects/convolution.cpp
index 1ee59604..5bb52656 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 || mChannels == FmtUHJ3) && target.RealOut
+ if((mChannels == FmtUHJ2 || mChannels == FmtUHJ3 || mChannels == FmtUHJ4) && target.RealOut
&& target.RealOut->ChannelIndex[FrontLeft] != INVALID_CHANNEL_INDEX
&& target.RealOut->ChannelIndex[FrontRight] != INVALID_CHANNEL_INDEX)
{
@@ -436,6 +436,7 @@ void ConvolutionState::update(const ALCcontext *context, const EffectSlot *slot,
case FmtBFormat3D:
case FmtUHJ2:
case FmtUHJ3:
+ case FmtUHJ4:
break;
}
diff --git a/alc/inprogext.h b/alc/inprogext.h
index 4f9c6715..091703e2 100644
--- a/alc/inprogext.h
+++ b/alc/inprogext.h
@@ -78,12 +78,15 @@ ALCboolean ALC_APIENTRY alcReopenDeviceSOFT(ALCdevice *device, const ALCchar *de
#ifndef AL_SOFT_UHJ
#define AL_SOFT_UHJ
-#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
+#define AL_FORMAT_UHJ2CHN8_SOFT 0x19A2
+#define AL_FORMAT_UHJ2CHN16_SOFT 0x19A3
+#define AL_FORMAT_UHJ2CHN_FLOAT32_SOFT 0x19A4
+#define AL_FORMAT_UHJ3CHN8_SOFT 0x19A5
+#define AL_FORMAT_UHJ3CHN16_SOFT 0x19A6
+#define AL_FORMAT_UHJ3CHN_FLOAT32_SOFT 0x19A7
+#define AL_FORMAT_UHJ4CHN8_SOFT 0x19A8
+#define AL_FORMAT_UHJ4CHN16_SOFT 0x19A9
+#define AL_FORMAT_UHJ4CHN_FLOAT32_SOFT 0x19AA
#endif
#ifdef __cplusplus
diff --git a/alc/voice.cpp b/alc/voice.cpp
index 577d5f72..7e761b29 100644
--- a/alc/voice.cpp
+++ b/alc/voice.cpp
@@ -529,7 +529,8 @@ void Voice::mix(const State vstate, ALCcontext *Context, const uint SamplesToDo)
Counter = std::min(Counter, 64u);
const uint PostPadding{MaxResamplerEdge +
- ((mFmtChannels==FmtUHJ2 || mFmtChannels==FmtUHJ3) ? uint{UhjDecoder::sFilterDelay} : 0u)};
+ ((mFmtChannels==FmtUHJ2 || mFmtChannels==FmtUHJ3 || mFmtChannels==FmtUHJ4)
+ ? uint{UhjDecoder::sFilterDelay} : 0u)};
uint buffers_done{0u};
uint OutPos{0u};
do {
@@ -635,9 +636,12 @@ void Voice::mix(const State vstate, ALCcontext *Context, const uint SamplesToDo)
if(mDecoder)
{
- std::array<float*,3> samples{{mVoiceSamples[0].data() + MaxResamplerEdge,
+ std::array<float*,4> samples{{mVoiceSamples[0].data() + MaxResamplerEdge,
mVoiceSamples[1].data() + MaxResamplerEdge,
- mVoiceSamples[2].data() + MaxResamplerEdge}};
+ mVoiceSamples[2].data() + MaxResamplerEdge,
+ nullptr}};
+ if(mVoiceSamples.size() > 3)
+ samples[3] = mVoiceSamples[3].data() + MaxResamplerEdge;
const size_t srcOffset{(increment*DstBufferSize + DataPosFrac)>>MixerFracBits};
SrcBufferSize = SrcBufferSize - PostPadding + MaxResamplerEdge;
mDecoder->decode(samples, SrcBufferSize, srcOffset);
@@ -823,9 +827,9 @@ void Voice::mix(const State vstate, ALCcontext *Context, const uint SamplesToDo)
void Voice::prepare(ALCdevice *device)
{
- if((mFmtChannels == FmtUHJ2 || mFmtChannels == FmtUHJ3) && !mDecoder)
+ if((mFmtChannels == FmtUHJ2 || mFmtChannels == FmtUHJ3 || mFmtChannels==FmtUHJ4) && !mDecoder)
mDecoder = std::make_unique<UhjDecoder>();
- else if(mFmtChannels != FmtUHJ2 && mFmtChannels != FmtUHJ3)
+ else if(mFmtChannels != FmtUHJ2 && mFmtChannels != FmtUHJ3 && mFmtChannels != FmtUHJ4)
mDecoder = nullptr;
/* Clear the stepping value explicitly so the mixer knows not to mix this