aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/alu.cpp4
-rw-r--r--Alc/bformatdec.cpp33
-rw-r--r--Alc/bformatdec.h4
3 files changed, 22 insertions, 19 deletions
diff --git a/Alc/alu.cpp b/Alc/alu.cpp
index 094f0dc6..b57a304d 100644
--- a/Alc/alu.cpp
+++ b/Alc/alu.cpp
@@ -147,7 +147,7 @@ void ProcessHrtf(ALCdevice *device, const ALsizei SamplesToDo)
void ProcessAmbiDec(ALCdevice *device, const ALsizei SamplesToDo)
{
BFormatDec *ambidec{device->AmbiDecoder.get()};
- ambidec->process(device->RealOut.Buffer, device->RealOut.NumChannels, device->Dry.Buffer,
+ ambidec->process({device->RealOut.Buffer, device->RealOut.NumChannels}, device->Dry.Buffer,
SamplesToDo);
}
@@ -168,7 +168,7 @@ void ProcessBs2b(ALCdevice *device, const ALsizei SamplesToDo)
{
/* First, decode the ambisonic mix to the "real" output. */
BFormatDec *ambidec{device->AmbiDecoder.get()};
- ambidec->process(device->RealOut.Buffer, device->RealOut.NumChannels, device->Dry.Buffer,
+ ambidec->process({device->RealOut.Buffer, device->RealOut.NumChannels}, device->Dry.Buffer,
SamplesToDo);
/* BS2B is stereo output only. */
diff --git a/Alc/bformatdec.cpp b/Alc/bformatdec.cpp
index 9c0c72ec..6ef398ec 100644
--- a/Alc/bformatdec.cpp
+++ b/Alc/bformatdec.cpp
@@ -146,12 +146,9 @@ BFormatDec::BFormatDec(const ALuint inchans, const ALsizei chancount,
}
-void BFormatDec::process(FloatBufferLine *OutBuffer, const ALuint OutChannels,
+void BFormatDec::process(const al::span<FloatBufferLine> OutBuffer,
const FloatBufferLine *InSamples, const ALsizei SamplesToDo)
{
- ASSUME(OutChannels > 0);
- ASSUME(mNumChannels > 0);
-
if(mDualBand)
{
for(ALuint i{0};i < mNumChannels;i++)
@@ -160,24 +157,30 @@ void BFormatDec::process(FloatBufferLine *OutBuffer, const ALuint OutChannels,
const al::span<const FloatBufferLine> hfsamples{mSamplesHF, mNumChannels};
const al::span<const FloatBufferLine> lfsamples{mSamplesLF, mNumChannels};
- for(ALuint chan{0};chan < OutChannels;chan++)
+ ALfloat (*mixmtx)[sNumBands][MAX_AMBI_CHANNELS]{mMatrix.Dual};
+ ALuint enabled{mEnabled};
+ for(FloatBufferLine &outbuf : OutBuffer)
{
- if(UNLIKELY(!(mEnabled&(1<<chan))))
- continue;
-
- MixRowSamples(OutBuffer[chan], mMatrix.Dual[chan][sHFBand], hfsamples, 0, SamplesToDo);
- MixRowSamples(OutBuffer[chan], mMatrix.Dual[chan][sLFBand], lfsamples, 0, SamplesToDo);
+ if(LIKELY(enabled&1))
+ {
+ MixRowSamples(outbuf, (*mixmtx)[sHFBand], hfsamples, 0, SamplesToDo);
+ MixRowSamples(outbuf, (*mixmtx)[sLFBand], lfsamples, 0, SamplesToDo);
+ }
+ ++mixmtx;
+ enabled >>= 1;
}
}
else
{
const al::span<const FloatBufferLine> insamples{InSamples, mNumChannels};
- for(ALuint chan{0};chan < OutChannels;chan++)
+ ALfloat (*mixmtx)[MAX_AMBI_CHANNELS]{mMatrix.Single};
+ ALuint enabled{mEnabled};
+ for(FloatBufferLine &outbuf : OutBuffer)
{
- if(UNLIKELY(!(mEnabled&(1<<chan))))
- continue;
-
- MixRowSamples(OutBuffer[chan], mMatrix.Single[chan], insamples, 0, SamplesToDo);
+ if(LIKELY(enabled&1))
+ MixRowSamples(outbuf, *mixmtx, insamples, 0, SamplesToDo);
+ ++mixmtx;
+ enabled >>= 1;
}
}
}
diff --git a/Alc/bformatdec.h b/Alc/bformatdec.h
index 47723815..1ec4a1bb 100644
--- a/Alc/bformatdec.h
+++ b/Alc/bformatdec.h
@@ -43,8 +43,8 @@ public:
const ALsizei (&chanmap)[MAX_OUTPUT_CHANNELS]);
/* Decodes the ambisonic input to the given output channels. */
- void process(FloatBufferLine *OutBuffer, const ALuint OutChannels,
- const FloatBufferLine *InSamples, const ALsizei SamplesToDo);
+ void process(const al::span<FloatBufferLine> OutBuffer, const FloatBufferLine *InSamples,
+ const ALsizei SamplesToDo);
/* Retrieves per-order HF scaling factors for "upsampling" ambisonic data. */
static std::array<ALfloat,MAX_AMBI_ORDER+1> GetHFOrderScales(const ALsizei in_order,