aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--alc/bformatdec.cpp13
-rw-r--r--alc/bformatdec.h8
-rw-r--r--alc/panning.cpp10
3 files changed, 13 insertions, 18 deletions
diff --git a/alc/bformatdec.cpp b/alc/bformatdec.cpp
index 3ef2fec0..6c9a6be4 100644
--- a/alc/bformatdec.cpp
+++ b/alc/bformatdec.cpp
@@ -98,17 +98,14 @@ BFormatDec::BFormatDec(const AmbDecConf *conf, const bool allow_2band, const ALu
}
}
-BFormatDec::BFormatDec(const ALuint inchans, const ChannelDec (&chancoeffs)[MAX_OUTPUT_CHANNELS],
- const al::span<const ALuint> chanmap) : mChannelDec{inchans}
+BFormatDec::BFormatDec(const ALuint inchans, const al::span<const ChannelDec> chancoeffs)
+ : mChannelDec{inchans}
{
for(size_t j{0};j < mChannelDec.size();++j)
{
- const ChannelDec *incoeffs{chancoeffs};
- for(const ALuint chanidx : chanmap)
- {
- mChannelDec[j].mGains.Single[chanidx] = (*incoeffs)[j];
- ++incoeffs;
- }
+ float *outcoeffs{mChannelDec[j].mGains.Single};
+ for(const ChannelDec &incoeffs : chancoeffs)
+ *(outcoeffs++) = incoeffs[j];
}
}
diff --git a/alc/bformatdec.h b/alc/bformatdec.h
index 980c907a..63f8c516 100644
--- a/alc/bformatdec.h
+++ b/alc/bformatdec.h
@@ -43,8 +43,7 @@ class BFormatDec {
public:
BFormatDec(const AmbDecConf *conf, const bool allow_2band, const ALuint inchans,
const ALuint srate, const ALuint (&chanmap)[MAX_OUTPUT_CHANNELS]);
- BFormatDec(const ALuint inchans, const ChannelDec (&chancoeffs)[MAX_OUTPUT_CHANNELS],
- const al::span<const ALuint> chanmap);
+ BFormatDec(const ALuint inchans, const al::span<const ChannelDec> chancoeffs);
/* Decodes the ambisonic input to the given output channels. */
void process(const al::span<FloatBufferLine> OutBuffer, const FloatBufferLine *InSamples,
@@ -61,10 +60,9 @@ public:
BFormatDec{conf, allow_2band, inchans, srate, chanmap}};
}
static std::unique_ptr<BFormatDec> Create(const ALuint inchans,
- const ChannelDec (&chancoeffs)[MAX_OUTPUT_CHANNELS], const al::span<const ALuint> chanmap)
+ const al::span<const ChannelDec> chancoeffs)
{
- return std::unique_ptr<BFormatDec>{new(FamCount{inchans})
- BFormatDec{inchans, chancoeffs, chanmap}};
+ return std::unique_ptr<BFormatDec>{new(FamCount{inchans}) BFormatDec{inchans, chancoeffs}};
}
DEF_FAM_NEWDEL(BFormatDec, mChannelDec)
diff --git a/alc/panning.cpp b/alc/panning.cpp
index f7dfa6d0..9a0a4267 100644
--- a/alc/panning.cpp
+++ b/alc/panning.cpp
@@ -434,7 +434,7 @@ void InitPanning(ALCdevice *device)
else
{
ChannelDec chancoeffs[MAX_OUTPUT_CHANNELS]{};
- ALuint idxmap[MAX_OUTPUT_CHANNELS]{};
+ ALuint maxchan{0};
for(size_t i{0u};i < chanmap.size();++i)
{
const ALuint idx{GetChannelIdxByName(device->RealOut, chanmap[i].ChanName)};
@@ -444,8 +444,8 @@ void InitPanning(ALCdevice *device)
GetLabelFromChannel(chanmap[i].ChanName));
continue;
}
- idxmap[i] = idx;
- std::copy_n(chanmap[i].Config, coeffcount, chancoeffs[i]);
+ maxchan = maxu(maxchan, idx);
+ std::copy_n(chanmap[i].Config, coeffcount, chancoeffs[idx]);
}
/* For non-DevFmtAmbi3D, set the ambisonic order given the mixing
@@ -464,8 +464,8 @@ void InitPanning(ALCdevice *device)
(coeffcount > 5) ? "third" :
(coeffcount > 3) ? "second" : "first",
"");
- device->AmbiDecoder = BFormatDec::Create(coeffcount, chancoeffs,
- al::span<const ALuint>{idxmap, chanmap.size()});
+ device->AmbiDecoder = BFormatDec::Create(coeffcount,
+ al::span<const ChannelDec>{chancoeffs, maxchan});
}
}