openal-soft/alc/bformatdec.h

61 lines
1.6 KiB
C
Raw Normal View History

#ifndef BFORMATDEC_H
#define BFORMATDEC_H
#include <array>
#include <cstddef>
#include "AL/al.h"
#include "alcmain.h"
#include "almalloc.h"
#include "alspan.h"
#include "ambidefs.h"
2019-08-05 18:36:39 -07:00
#include "devformat.h"
#include "filters/splitter.h"
#include "vector.h"
struct AmbDecConf;
using ChannelDec = float[MAX_AMBI_CHANNELS];
class BFormatDec {
static constexpr size_t sHFBand{0};
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;
};
alignas(16) std::array<FloatBufferLine,2> mSamples;
bool mDualBand{false};
al::FlexArray<ChannelDecoder> mChannelDec;
public:
2019-06-05 19:26:54 -07:00
BFormatDec(const AmbDecConf *conf, const bool allow_2band, const ALuint inchans,
2019-09-12 04:17:21 -07:00
const ALuint srate, const ALuint (&chanmap)[MAX_OUTPUT_CHANNELS]);
2020-01-04 00:37:59 -08:00
BFormatDec(const ALuint inchans, const ChannelDec (&chancoeffs)[MAX_OUTPUT_CHANNELS],
const al::span<const ALuint> chanmap);
/* Decodes the ambisonic input to the given output channels. */
2019-07-03 22:59:29 -07:00
void process(const al::span<FloatBufferLine> OutBuffer, const FloatBufferLine *InSamples,
const size_t SamplesToDo);
/* Retrieves per-order HF scaling factors for "upsampling" ambisonic data. */
2020-01-14 13:10:01 -08:00
static std::array<float,MAX_AMBI_ORDER+1> GetHFOrderScales(const ALuint in_order,
2019-09-13 20:04:22 -07:00
const ALuint out_order) noexcept;
DEF_FAM_NEWDEL(BFormatDec, mChannelDec)
};
#endif /* BFORMATDEC_H */