mirror of
https://github.com/love2d/megasource.git
synced 2026-08-17 11:11:35 +02:00
Update OpenAL-soft to 1.23.1-bc7cb17.
This commit is contained in:
@@ -4,16 +4,15 @@
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
#include "almalloc.h"
|
||||
#include "alspan.h"
|
||||
#include "ambidefs.h"
|
||||
#include "bufferline.h"
|
||||
#include "devformat.h"
|
||||
#include "filters/splitter.h"
|
||||
#include "vector.h"
|
||||
|
||||
struct FrontStablizer;
|
||||
#include "front_stablizer.h"
|
||||
|
||||
|
||||
using ChannelDec = std::array<float,MaxAmbiChannels>;
|
||||
@@ -23,49 +22,40 @@ class BFormatDec {
|
||||
static constexpr size_t sLFBand{1};
|
||||
static constexpr size_t sNumBands{2};
|
||||
|
||||
struct ChannelDecoder {
|
||||
union MatrixU {
|
||||
float Dual[sNumBands][MAX_OUTPUT_CHANNELS];
|
||||
float Single[MAX_OUTPUT_CHANNELS];
|
||||
} mGains{};
|
||||
|
||||
/* NOTE: BandSplitter filter is unused with single-band decoding. */
|
||||
BandSplitter mXOver;
|
||||
struct ChannelDecoderSingle {
|
||||
std::array<float,MaxOutputChannels> mGains{};
|
||||
};
|
||||
|
||||
alignas(16) std::array<FloatBufferLine,2> mSamples;
|
||||
struct ChannelDecoderDual {
|
||||
BandSplitter mXOver;
|
||||
std::array<std::array<float,MaxOutputChannels>,sNumBands> mGains{};
|
||||
};
|
||||
|
||||
alignas(16) std::array<FloatBufferLine,2> mSamples{};
|
||||
|
||||
const std::unique_ptr<FrontStablizer> mStablizer;
|
||||
const bool mDualBand{false};
|
||||
|
||||
/* TODO: This should ideally be a FlexArray, since ChannelDecoder is rather
|
||||
* small and only a few are needed (3, 4, 5, 7, typically). But that can
|
||||
* only be used in a standard layout struct, and a std::unique_ptr member
|
||||
* (mStablizer) causes GCC and Clang to warn it's not.
|
||||
*/
|
||||
al::vector<ChannelDecoder> mChannelDec;
|
||||
std::variant<std::vector<ChannelDecoderSingle>,std::vector<ChannelDecoderDual>> mChannelDec;
|
||||
|
||||
public:
|
||||
BFormatDec(const size_t inchans, const al::span<const ChannelDec> coeffs,
|
||||
const al::span<const ChannelDec> coeffslf, const float xover_f0norm,
|
||||
std::unique_ptr<FrontStablizer> stablizer);
|
||||
|
||||
bool hasStablizer() const noexcept { return mStablizer != nullptr; }
|
||||
[[nodiscard]] auto hasStablizer() const noexcept -> bool { return mStablizer != nullptr; }
|
||||
|
||||
/* Decodes the ambisonic input to the given output channels. */
|
||||
void process(const al::span<FloatBufferLine> OutBuffer, const FloatBufferLine *InSamples,
|
||||
const size_t SamplesToDo);
|
||||
void process(const al::span<FloatBufferLine> OutBuffer,
|
||||
const al::span<const FloatBufferLine> InSamples, const size_t SamplesToDo);
|
||||
|
||||
/* Decodes the ambisonic input to the given output channels with stablization. */
|
||||
void processStablize(const al::span<FloatBufferLine> OutBuffer,
|
||||
const FloatBufferLine *InSamples, const size_t lidx, const size_t ridx, const size_t cidx,
|
||||
const size_t SamplesToDo);
|
||||
const al::span<const FloatBufferLine> InSamples, const size_t lidx, const size_t ridx,
|
||||
const size_t cidx, const size_t SamplesToDo);
|
||||
|
||||
static std::unique_ptr<BFormatDec> Create(const size_t inchans,
|
||||
const al::span<const ChannelDec> coeffs, const al::span<const ChannelDec> coeffslf,
|
||||
const float xover_f0norm, std::unique_ptr<FrontStablizer> stablizer);
|
||||
|
||||
DEF_NEWDEL(BFormatDec)
|
||||
};
|
||||
|
||||
#endif /* CORE_BFORMATDEC_H */
|
||||
|
||||
Reference in New Issue
Block a user