aboutsummaryrefslogtreecommitdiffstats
path: root/alc/voice.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2021-03-31 20:46:03 -0700
committerChris Robinson <[email protected]>2021-03-31 21:02:30 -0700
commitf33edc3b30ee2975464b308f800f6918c0362283 (patch)
tree285ba54c9c791d596e880f3b3a4ebfb2ddbe87b5 /alc/voice.cpp
parentb5e36007f136f817e6d14685377e781e224daf17 (diff)
Add support for 4-channel UHJ
Also add the SOFT moniker to the new macros
Diffstat (limited to 'alc/voice.cpp')
-rw-r--r--alc/voice.cpp14
1 files changed, 9 insertions, 5 deletions
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