Make a couple helper methods to create BFormatDec
This commit is contained in:
+14
-1
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
|
||||
#include "AL/al.h"
|
||||
|
||||
@@ -12,7 +13,6 @@
|
||||
#include "ambidefs.h"
|
||||
#include "devformat.h"
|
||||
#include "filters/splitter.h"
|
||||
#include "vector.h"
|
||||
|
||||
struct AmbDecConf;
|
||||
|
||||
@@ -54,6 +54,19 @@ public:
|
||||
static std::array<float,MAX_AMBI_ORDER+1> GetHFOrderScales(const ALuint in_order,
|
||||
const ALuint out_order) noexcept;
|
||||
|
||||
static std::unique_ptr<BFormatDec> Create(const AmbDecConf *conf, const bool allow_2band,
|
||||
const ALuint inchans, const ALuint srate, const ALuint (&chanmap)[MAX_OUTPUT_CHANNELS])
|
||||
{
|
||||
return std::unique_ptr<BFormatDec>{new(FamCount{inchans})
|
||||
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)
|
||||
{
|
||||
return std::unique_ptr<BFormatDec>{new(FamCount{inchans})
|
||||
BFormatDec{inchans, chancoeffs, chanmap}};
|
||||
}
|
||||
|
||||
DEF_FAM_NEWDEL(BFormatDec, mChannelDec)
|
||||
};
|
||||
|
||||
|
||||
+5
-6
@@ -464,8 +464,8 @@ void InitPanning(ALCdevice *device)
|
||||
(coeffcount > 5) ? "third" :
|
||||
(coeffcount > 3) ? "second" : "first",
|
||||
"");
|
||||
device->AmbiDecoder.reset(new(FamCount{coeffcount}) BFormatDec{coeffcount, chancoeffs,
|
||||
al::span<const ALuint>{idxmap, chanmap.size()}});
|
||||
device->AmbiDecoder = BFormatDec::Create(coeffcount, chancoeffs,
|
||||
al::span<const ALuint>{idxmap, chanmap.size()});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,14 +505,13 @@ void InitCustomPanning(ALCdevice *device, bool hqdec, const AmbDecConf *conf,
|
||||
(conf->ChanMask > AMBI_1ORDER_MASK) ? "second" : "first",
|
||||
(conf->ChanMask&AMBI_PERIPHONIC_MASK) ? " periphonic" : ""
|
||||
);
|
||||
device->AmbiDecoder.reset(new(FamCount{count}) BFormatDec{conf, hqdec, count,
|
||||
device->Frequency, speakermap});
|
||||
device->AmbiDecoder = BFormatDec::Create(conf, hqdec, count, device->Frequency, speakermap);
|
||||
|
||||
auto accum_spkr_dist = std::bind(std::plus<float>{}, _1,
|
||||
std::bind(std::mem_fn(&AmbDecConf::SpeakerConf::Distance), _2));
|
||||
const ALfloat avg_dist{
|
||||
const float avg_dist{
|
||||
std::accumulate(conf->Speakers.begin(), conf->Speakers.end(), 0.0f, accum_spkr_dist) /
|
||||
static_cast<ALfloat>(conf->Speakers.size())};
|
||||
static_cast<float>(conf->Speakers.size())};
|
||||
InitNearFieldCtrl(device, avg_dist, order, !!(conf->ChanMask&AMBI_PERIPHONIC_MASK));
|
||||
|
||||
InitDistanceComp(device, conf, speakermap);
|
||||
|
||||
Reference in New Issue
Block a user