diff options
-rw-r--r-- | Alc/bformatdec.cpp | 15 | ||||
-rw-r--r-- | Alc/bformatdec.h | 17 | ||||
-rw-r--r-- | Alc/panning.cpp | 11 |
3 files changed, 15 insertions, 28 deletions
diff --git a/Alc/bformatdec.cpp b/Alc/bformatdec.cpp index fe943d9d..563282a7 100644 --- a/Alc/bformatdec.cpp +++ b/Alc/bformatdec.cpp @@ -49,14 +49,9 @@ inline auto GetAmbiScales(AmbDecScale scaletype) noexcept -> const std::array<fl } // namespace -void BFormatDec::reset(const AmbDecConf *conf, const bool allow_2band, const ALsizei inchans, +BFormatDec::BFormatDec(const AmbDecConf *conf, const bool allow_2band, const ALsizei inchans, const ALuint srate, const ALsizei (&chanmap)[MAX_OUTPUT_CHANNELS]) { - mSamples.clear(); - mSamplesHF = nullptr; - mSamplesLF = nullptr; - - mMatrix = MatrixU{}; mDualBand = allow_2band && (conf->FreqBands == 2); if(!mDualBand) mSamples.resize(2); @@ -124,16 +119,10 @@ void BFormatDec::reset(const AmbDecConf *conf, const bool allow_2band, const ALs } } -void BFormatDec::reset(const ALsizei inchans, const ALsizei chancount, +BFormatDec::BFormatDec(const ALsizei inchans, const ALsizei chancount, const ChannelDec (&chancoeffs)[MAX_OUTPUT_CHANNELS], const ALsizei (&chanmap)[MAX_OUTPUT_CHANNELS]) { - mSamples.clear(); - mSamplesHF = nullptr; - mSamplesLF = nullptr; - - mMatrix = MatrixU{}; - mDualBand = false; mSamples.resize(2); mNumChannels = inchans; diff --git a/Alc/bformatdec.h b/Alc/bformatdec.h index 7dc283f7..d82f08ac 100644 --- a/Alc/bformatdec.h +++ b/Alc/bformatdec.h @@ -17,29 +17,28 @@ class BFormatDec { static constexpr size_t sLFBand{1}; static constexpr size_t sNumBands{2}; - ALuint mEnabled; /* Bitfield of enabled channels. */ + ALuint mEnabled{0u}; /* Bitfield of enabled channels. */ union MatrixU { ALfloat Dual[MAX_OUTPUT_CHANNELS][sNumBands][MAX_AMBI_CHANNELS]; ALfloat Single[MAX_OUTPUT_CHANNELS][MAX_AMBI_CHANNELS]; - } mMatrix; + } mMatrix{}; /* NOTE: BandSplitter filters are unused with single-band decoding */ BandSplitter mXOver[MAX_AMBI_CHANNELS]; al::vector<std::array<ALfloat,BUFFERSIZE>, 16> mSamples; /* These two alias into Samples */ - std::array<ALfloat,BUFFERSIZE> *mSamplesHF; - std::array<ALfloat,BUFFERSIZE> *mSamplesLF; + std::array<ALfloat,BUFFERSIZE> *mSamplesHF{nullptr}; + std::array<ALfloat,BUFFERSIZE> *mSamplesLF{nullptr}; - ALsizei mNumChannels; - ALboolean mDualBand; + ALsizei mNumChannels{0}; + bool mDualBand{false}; public: - void reset(const AmbDecConf *conf, const bool allow_2band, const ALsizei inchans, + BFormatDec(const AmbDecConf *conf, const bool allow_2band, const ALsizei inchans, const ALuint srate, const ALsizei (&chanmap)[MAX_OUTPUT_CHANNELS]); - - void reset(const ALsizei inchans, const ALsizei chancount, + BFormatDec(const ALsizei inchans, const ALsizei chancount, const ChannelDec (&chancoeffs)[MAX_OUTPUT_CHANNELS], const ALsizei (&chanmap)[MAX_OUTPUT_CHANNELS]); diff --git a/Alc/panning.cpp b/Alc/panning.cpp index 34984c94..25be847f 100644 --- a/Alc/panning.cpp +++ b/Alc/panning.cpp @@ -440,8 +440,7 @@ void InitPanning(ALCdevice *device) (coeffcount > 3) ? "second" : "first", "" ); - device->AmbiDecoder = al::make_unique<BFormatDec>(); - device->AmbiDecoder->reset(coeffcount, count, chancoeffs, idxmap); + device->AmbiDecoder = al::make_unique<BFormatDec>(coeffcount, count, chancoeffs, idxmap); device->RealOut.NumChannels = device->channelsFromFmt(); } @@ -481,8 +480,8 @@ void InitCustomPanning(ALCdevice *device, const AmbDecConf *conf, const ALsizei (conf->ChanMask > AMBI_1ORDER_MASK) ? "second" : "first", (conf->ChanMask&AMBI_PERIPHONIC_MASK) ? " periphonic" : "" ); - device->AmbiDecoder = al::make_unique<BFormatDec>(); - device->AmbiDecoder->reset(conf, false, count, device->Frequency, speakermap); + device->AmbiDecoder = al::make_unique<BFormatDec>(conf, false, count, device->Frequency, + speakermap); device->RealOut.NumChannels = device->channelsFromFmt(); @@ -523,8 +522,8 @@ void InitHQPanning(ALCdevice *device, const AmbDecConf *conf, const ALsizei (&sp (conf->ChanMask > AMBI_1ORDER_MASK) ? "second" : "first", (conf->ChanMask&AMBI_PERIPHONIC_MASK) ? " periphonic" : "" ); - device->AmbiDecoder = al::make_unique<BFormatDec>(); - device->AmbiDecoder->reset(conf, true, count, device->Frequency, speakermap); + device->AmbiDecoder = al::make_unique<BFormatDec>(conf, true, count, device->Frequency, + speakermap); device->RealOut.NumChannels = device->channelsFromFmt(); |