You've already forked openal-soft
mirror of
https://github.com/OldUnreal/openal-soft.git
synced 2026-04-02 21:38:01 -07:00
Much more clang-tidy cleanup
This commit is contained in:
@@ -55,31 +55,31 @@ namespace {
|
||||
|
||||
struct FactoryItem {
|
||||
EffectSlotType Type;
|
||||
EffectStateFactory* (&GetFactory)(void);
|
||||
EffectStateFactory* (&GetFactory)();
|
||||
};
|
||||
constexpr FactoryItem FactoryList[] = {
|
||||
{ EffectSlotType::None, NullStateFactory_getFactory },
|
||||
{ EffectSlotType::EAXReverb, ReverbStateFactory_getFactory },
|
||||
{ EffectSlotType::Reverb, StdReverbStateFactory_getFactory },
|
||||
{ EffectSlotType::Autowah, AutowahStateFactory_getFactory },
|
||||
{ EffectSlotType::Chorus, ChorusStateFactory_getFactory },
|
||||
{ EffectSlotType::Compressor, CompressorStateFactory_getFactory },
|
||||
{ EffectSlotType::Distortion, DistortionStateFactory_getFactory },
|
||||
{ EffectSlotType::Echo, EchoStateFactory_getFactory },
|
||||
{ EffectSlotType::Equalizer, EqualizerStateFactory_getFactory },
|
||||
{ EffectSlotType::Flanger, FlangerStateFactory_getFactory },
|
||||
{ EffectSlotType::FrequencyShifter, FshifterStateFactory_getFactory },
|
||||
{ EffectSlotType::RingModulator, ModulatorStateFactory_getFactory },
|
||||
{ EffectSlotType::PitchShifter, PshifterStateFactory_getFactory },
|
||||
{ EffectSlotType::VocalMorpher, VmorpherStateFactory_getFactory },
|
||||
{ EffectSlotType::DedicatedDialog, DedicatedStateFactory_getFactory },
|
||||
{ EffectSlotType::DedicatedLFE, DedicatedStateFactory_getFactory },
|
||||
{ EffectSlotType::Convolution, ConvolutionStateFactory_getFactory },
|
||||
constexpr std::array FactoryList{
|
||||
FactoryItem{EffectSlotType::None, NullStateFactory_getFactory},
|
||||
FactoryItem{EffectSlotType::EAXReverb, ReverbStateFactory_getFactory},
|
||||
FactoryItem{EffectSlotType::Reverb, StdReverbStateFactory_getFactory},
|
||||
FactoryItem{EffectSlotType::Autowah, AutowahStateFactory_getFactory},
|
||||
FactoryItem{EffectSlotType::Chorus, ChorusStateFactory_getFactory},
|
||||
FactoryItem{EffectSlotType::Compressor, CompressorStateFactory_getFactory},
|
||||
FactoryItem{EffectSlotType::Distortion, DistortionStateFactory_getFactory},
|
||||
FactoryItem{EffectSlotType::Echo, EchoStateFactory_getFactory},
|
||||
FactoryItem{EffectSlotType::Equalizer, EqualizerStateFactory_getFactory},
|
||||
FactoryItem{EffectSlotType::Flanger, FlangerStateFactory_getFactory},
|
||||
FactoryItem{EffectSlotType::FrequencyShifter, FshifterStateFactory_getFactory},
|
||||
FactoryItem{EffectSlotType::RingModulator, ModulatorStateFactory_getFactory},
|
||||
FactoryItem{EffectSlotType::PitchShifter, PshifterStateFactory_getFactory},
|
||||
FactoryItem{EffectSlotType::VocalMorpher, VmorpherStateFactory_getFactory},
|
||||
FactoryItem{EffectSlotType::DedicatedDialog, DedicatedStateFactory_getFactory},
|
||||
FactoryItem{EffectSlotType::DedicatedLFE, DedicatedStateFactory_getFactory},
|
||||
FactoryItem{EffectSlotType::Convolution, ConvolutionStateFactory_getFactory},
|
||||
};
|
||||
|
||||
EffectStateFactory *getFactoryByType(EffectSlotType type)
|
||||
{
|
||||
auto iter = std::find_if(std::begin(FactoryList), std::end(FactoryList),
|
||||
auto iter = std::find_if(FactoryList.begin(), FactoryList.end(),
|
||||
[type](const FactoryItem &item) noexcept -> bool
|
||||
{ return item.Type == type; });
|
||||
return (iter != std::end(FactoryList)) ? iter->GetFactory() : nullptr;
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <stddef.h>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@@ -22,8 +22,7 @@ EaxCall::EaxCall(
|
||||
ALuint property_source_id,
|
||||
ALvoid* property_buffer,
|
||||
ALuint property_size)
|
||||
: mCallType{type}, mVersion{0}, mPropertySetId{EaxCallPropertySetId::none}
|
||||
, mIsDeferred{(property_id & deferred_flag) != 0}
|
||||
: mCallType{type}, mIsDeferred{(property_id & deferred_flag) != 0}
|
||||
, mPropertyId{property_id & ~deferred_flag}, mPropertySourceId{property_source_id}
|
||||
, mPropertyBuffer{property_buffer}, mPropertyBufferSize{property_size}
|
||||
{
|
||||
|
||||
@@ -71,16 +71,16 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
const EaxCallType mCallType{};
|
||||
const EaxCallType mCallType;
|
||||
int mVersion{};
|
||||
EaxFxSlotIndex mFxSlotIndex{};
|
||||
EaxCallPropertySetId mPropertySetId{};
|
||||
bool mIsDeferred{};
|
||||
EaxCallPropertySetId mPropertySetId{EaxCallPropertySetId::none};
|
||||
bool mIsDeferred;
|
||||
|
||||
const ALuint mPropertyId{};
|
||||
const ALuint mPropertySourceId{};
|
||||
ALvoid*const mPropertyBuffer{};
|
||||
const ALuint mPropertyBufferSize{};
|
||||
const ALuint mPropertyId;
|
||||
const ALuint mPropertySourceId;
|
||||
ALvoid*const mPropertyBuffer;
|
||||
const ALuint mPropertyBufferSize;
|
||||
|
||||
[[noreturn]] static void fail(const char* message);
|
||||
[[noreturn]] static void fail_too_small();
|
||||
|
||||
@@ -94,24 +94,24 @@ struct EffectPropsItem {
|
||||
const EffectProps &DefaultProps;
|
||||
const EffectVtable &Vtable;
|
||||
};
|
||||
constexpr EffectPropsItem EffectPropsList[] = {
|
||||
{ AL_EFFECT_NULL, NullEffectProps, NullEffectVtable },
|
||||
{ AL_EFFECT_EAXREVERB, ReverbEffectProps, ReverbEffectVtable },
|
||||
{ AL_EFFECT_REVERB, StdReverbEffectProps, StdReverbEffectVtable },
|
||||
{ AL_EFFECT_AUTOWAH, AutowahEffectProps, AutowahEffectVtable },
|
||||
{ AL_EFFECT_CHORUS, ChorusEffectProps, ChorusEffectVtable },
|
||||
{ AL_EFFECT_COMPRESSOR, CompressorEffectProps, CompressorEffectVtable },
|
||||
{ AL_EFFECT_DISTORTION, DistortionEffectProps, DistortionEffectVtable },
|
||||
{ AL_EFFECT_ECHO, EchoEffectProps, EchoEffectVtable },
|
||||
{ AL_EFFECT_EQUALIZER, EqualizerEffectProps, EqualizerEffectVtable },
|
||||
{ AL_EFFECT_FLANGER, FlangerEffectProps, FlangerEffectVtable },
|
||||
{ AL_EFFECT_FREQUENCY_SHIFTER, FshifterEffectProps, FshifterEffectVtable },
|
||||
{ AL_EFFECT_RING_MODULATOR, ModulatorEffectProps, ModulatorEffectVtable },
|
||||
{ AL_EFFECT_PITCH_SHIFTER, PshifterEffectProps, PshifterEffectVtable },
|
||||
{ AL_EFFECT_VOCAL_MORPHER, VmorpherEffectProps, VmorpherEffectVtable },
|
||||
{ AL_EFFECT_DEDICATED_DIALOGUE, DedicatedEffectProps, DedicatedEffectVtable },
|
||||
{ AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT, DedicatedEffectProps, DedicatedEffectVtable },
|
||||
{ AL_EFFECT_CONVOLUTION_SOFT, ConvolutionEffectProps, ConvolutionEffectVtable },
|
||||
constexpr std::array EffectPropsList{
|
||||
EffectPropsItem{AL_EFFECT_NULL, NullEffectProps, NullEffectVtable},
|
||||
EffectPropsItem{AL_EFFECT_EAXREVERB, ReverbEffectProps, ReverbEffectVtable},
|
||||
EffectPropsItem{AL_EFFECT_REVERB, StdReverbEffectProps, StdReverbEffectVtable},
|
||||
EffectPropsItem{AL_EFFECT_AUTOWAH, AutowahEffectProps, AutowahEffectVtable},
|
||||
EffectPropsItem{AL_EFFECT_CHORUS, ChorusEffectProps, ChorusEffectVtable},
|
||||
EffectPropsItem{AL_EFFECT_COMPRESSOR, CompressorEffectProps, CompressorEffectVtable},
|
||||
EffectPropsItem{AL_EFFECT_DISTORTION, DistortionEffectProps, DistortionEffectVtable},
|
||||
EffectPropsItem{AL_EFFECT_ECHO, EchoEffectProps, EchoEffectVtable},
|
||||
EffectPropsItem{AL_EFFECT_EQUALIZER, EqualizerEffectProps, EqualizerEffectVtable},
|
||||
EffectPropsItem{AL_EFFECT_FLANGER, FlangerEffectProps, FlangerEffectVtable},
|
||||
EffectPropsItem{AL_EFFECT_FREQUENCY_SHIFTER, FshifterEffectProps, FshifterEffectVtable},
|
||||
EffectPropsItem{AL_EFFECT_RING_MODULATOR, ModulatorEffectProps, ModulatorEffectVtable},
|
||||
EffectPropsItem{AL_EFFECT_PITCH_SHIFTER, PshifterEffectProps, PshifterEffectVtable},
|
||||
EffectPropsItem{AL_EFFECT_VOCAL_MORPHER, VmorpherEffectProps, VmorpherEffectVtable},
|
||||
EffectPropsItem{AL_EFFECT_DEDICATED_DIALOGUE, DedicatedEffectProps, DedicatedEffectVtable},
|
||||
EffectPropsItem{AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT, DedicatedEffectProps, DedicatedEffectVtable},
|
||||
EffectPropsItem{AL_EFFECT_CONVOLUTION_SOFT, ConvolutionEffectProps, ConvolutionEffectVtable},
|
||||
};
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ void ALeffect_getParamfv(const ALeffect *effect, ALenum param, float *values)
|
||||
|
||||
const EffectPropsItem *getEffectPropsItemByType(ALenum type)
|
||||
{
|
||||
auto iter = std::find_if(std::begin(EffectPropsList), std::end(EffectPropsList),
|
||||
auto iter = std::find_if(EffectPropsList.begin(), EffectPropsList.end(),
|
||||
[type](const EffectPropsItem &item) noexcept -> bool
|
||||
{ return item.Type == type; });
|
||||
return (iter != std::end(EffectPropsList)) ? al::to_address(iter) : nullptr;
|
||||
@@ -542,11 +542,12 @@ EffectSubList::~EffectSubList()
|
||||
}
|
||||
|
||||
|
||||
#define DECL(x) { #x, EFX_REVERB_PRESET_##x }
|
||||
static const struct {
|
||||
const char name[32];
|
||||
struct EffectPreset {
|
||||
const char name[32]; /* NOLINT(*-avoid-c-arrays) */
|
||||
EFXEAXREVERBPROPERTIES props;
|
||||
} reverblist[] = {
|
||||
};
|
||||
#define DECL(x) EffectPreset{#x, EFX_REVERB_PRESET_##x}
|
||||
static constexpr std::array reverblist{
|
||||
DECL(GENERIC),
|
||||
DECL(PADDEDCELL),
|
||||
DECL(ROOM),
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
filter_exception(ALenum code, const char *msg, ...);
|
||||
~filter_exception() override;
|
||||
|
||||
ALenum errorCode() const noexcept { return mErrorCode; }
|
||||
[[nodiscard]] auto errorCode() const noexcept -> ALenum { return mErrorCode; }
|
||||
};
|
||||
|
||||
filter_exception::filter_exception(ALenum code, const char* msg, ...) : mErrorCode{code}
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
/* NOLINTBEGIN(*-avoid-c-arrays) */
|
||||
constexpr ALchar alVendor[] = "OpenAL Community";
|
||||
constexpr ALchar alVersion[] = "1.1 ALSOFT " ALSOFT_VERSION;
|
||||
constexpr ALchar alRenderer[] = "OpenAL Soft";
|
||||
@@ -73,6 +74,7 @@ constexpr ALchar alErrInvalidOp[] = "Invalid Operation";
|
||||
constexpr ALchar alErrOutOfMemory[] = "Out of Memory";
|
||||
constexpr ALchar alStackOverflow[] = "Stack Overflow";
|
||||
constexpr ALchar alStackUnderflow[] = "Stack Underflow";
|
||||
/* NOLINTEND(*-avoid-c-arrays) */
|
||||
|
||||
/* Resampler strings */
|
||||
template<Resampler rtype> struct ResamplerName { };
|
||||
|
||||
@@ -42,6 +42,7 @@ using std::chrono::seconds;
|
||||
using std::chrono::milliseconds;
|
||||
using std::chrono::nanoseconds;
|
||||
|
||||
/* NOLINTNEXTLINE(*-avoid-c-arrays) */
|
||||
constexpr char nullDevice[] = "No Output";
|
||||
|
||||
|
||||
|
||||
@@ -1420,8 +1420,7 @@ class PipeWirePlayback final : public BackendBase {
|
||||
PwStreamPtr mStream;
|
||||
spa_hook mStreamListener{};
|
||||
spa_io_rate_match *mRateMatch{};
|
||||
std::unique_ptr<float*[]> mChannelPtrs;
|
||||
uint mNumChannels{};
|
||||
std::vector<float*> mChannelPtrs;
|
||||
|
||||
static constexpr pw_stream_events CreateEvents()
|
||||
{
|
||||
@@ -1468,7 +1467,7 @@ void PipeWirePlayback::outputCallback() noexcept
|
||||
if(!pw_buf) UNLIKELY return;
|
||||
|
||||
const al::span<spa_data> datas{pw_buf->buffer->datas,
|
||||
minu(mNumChannels, pw_buf->buffer->n_datas)};
|
||||
minz(mChannelPtrs.size(), pw_buf->buffer->n_datas)};
|
||||
#if PW_CHECK_VERSION(0,3,49)
|
||||
/* In 0.3.49, pw_buffer::requested specifies the number of samples needed
|
||||
* by the resampler/graph for this audio update.
|
||||
@@ -1488,7 +1487,7 @@ void PipeWirePlayback::outputCallback() noexcept
|
||||
* buffer length in any one channel is smaller than we wanted (shouldn't
|
||||
* be, but just in case).
|
||||
*/
|
||||
float **chanptr_end{mChannelPtrs.get()};
|
||||
auto chanptr_end = mChannelPtrs.begin();
|
||||
for(const auto &data : datas)
|
||||
{
|
||||
length = minu(length, data.maxsize/sizeof(float));
|
||||
@@ -1500,7 +1499,7 @@ void PipeWirePlayback::outputCallback() noexcept
|
||||
data.chunk->size = length * sizeof(float);
|
||||
}
|
||||
|
||||
mDevice->renderSamples({mChannelPtrs.get(), chanptr_end}, length);
|
||||
mDevice->renderSamples(mChannelPtrs, length);
|
||||
|
||||
pw_buf->size = length;
|
||||
pw_stream_queue_buffer(mStream.get(), pw_buf);
|
||||
@@ -1711,8 +1710,7 @@ bool PipeWirePlayback::reset()
|
||||
*/
|
||||
plock.unlock();
|
||||
|
||||
mNumChannels = mDevice->channelsFromFmt();
|
||||
mChannelPtrs = std::make_unique<float*[]>(mNumChannels);
|
||||
mChannelPtrs.resize(mDevice->channelsFromFmt());
|
||||
|
||||
setDefaultWFXChannelOrder();
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr char pa_device[] = "PortAudio Default";
|
||||
/* NOLINTNEXTLINE(*-avoid-c-arrays) */
|
||||
constexpr char pa_device[]{"PortAudio Default"};
|
||||
|
||||
|
||||
#ifdef HAVE_DYNLOAD
|
||||
|
||||
@@ -46,7 +46,8 @@ namespace {
|
||||
#define DEVNAME_PREFIX ""
|
||||
#endif
|
||||
|
||||
constexpr char defaultDeviceName[] = DEVNAME_PREFIX "Default Device";
|
||||
/* NOLINTNEXTLINE(*-avoid-c-arrays) */
|
||||
constexpr char defaultDeviceName[]{DEVNAME_PREFIX "Default Device"};
|
||||
|
||||
struct Sdl2Backend final : public BackendBase {
|
||||
Sdl2Backend(DeviceBase *device) noexcept : BackendBase{device} { }
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
#include <numeric>
|
||||
#include <stddef.h>
|
||||
#include <stdexcept>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <numeric>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "albit.h"
|
||||
#include "alconfig.h"
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
#include <array>
|
||||
#include <complex>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <stdint.h>
|
||||
#include <utility>
|
||||
|
||||
#ifdef HAVE_SSE_INTRINSICS
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <cstddef>
|
||||
|
||||
#include "almalloc.h"
|
||||
#include "alspan.h"
|
||||
|
||||
247
alc/panning.cpp
247
alc/panning.cpp
@@ -227,10 +227,10 @@ struct DecoderConfig<DualBand, 0> {
|
||||
using DecoderView = DecoderConfig<DualBand, 0>;
|
||||
|
||||
|
||||
void InitNearFieldCtrl(ALCdevice *device, float ctrl_dist, uint order, bool is3d)
|
||||
void InitNearFieldCtrl(ALCdevice *device, const float ctrl_dist, const uint order, const bool is3d)
|
||||
{
|
||||
static const uint chans_per_order2d[MaxAmbiOrder+1]{ 1, 2, 2, 2 };
|
||||
static const uint chans_per_order3d[MaxAmbiOrder+1]{ 1, 3, 5, 7 };
|
||||
static const std::array<uint,MaxAmbiOrder+1> chans_per_order2d{{1, 2, 2, 2}};
|
||||
static const std::array<uint,MaxAmbiOrder+1> chans_per_order3d{{1, 3, 5, 7}};
|
||||
|
||||
/* NFC is only used when AvgSpeakerDist is greater than 0. */
|
||||
if(!device->getConfigValueBool("decoder", "nfc", false) || !(ctrl_dist > 0.0f))
|
||||
@@ -243,7 +243,7 @@ void InitNearFieldCtrl(ALCdevice *device, float ctrl_dist, uint order, bool is3d
|
||||
(device->AvgSpeakerDist * static_cast<float>(device->Frequency))};
|
||||
device->mNFCtrlFilter.init(w1);
|
||||
|
||||
auto iter = std::copy_n(is3d ? chans_per_order3d : chans_per_order2d, order+1u,
|
||||
auto iter = std::copy_n(is3d ? chans_per_order3d.begin() : chans_per_order2d.begin(), order+1u,
|
||||
std::begin(device->NumChannelsPerOrder));
|
||||
std::fill(iter, std::end(device->NumChannelsPerOrder), 0u);
|
||||
}
|
||||
@@ -361,8 +361,7 @@ DecoderView MakeDecoderView(ALCdevice *device, const AmbDecConf *conf,
|
||||
const auto lfmatrix = conf->LFMatrix;
|
||||
|
||||
uint chan_count{0};
|
||||
using const_speaker_span = al::span<const AmbDecConf::SpeakerConf>;
|
||||
for(auto &speaker : const_speaker_span{conf->Speakers.get(), conf->NumSpeakers})
|
||||
for(auto &speaker : al::span<const AmbDecConf::SpeakerConf>{conf->Speakers})
|
||||
{
|
||||
/* NOTE: AmbDec does not define any standard speaker names, however
|
||||
* for this to work we have to by able to find the output channel
|
||||
@@ -708,120 +707,126 @@ void InitPanning(ALCdevice *device, const bool hqdec=false, const bool stablize=
|
||||
|
||||
void InitHrtfPanning(ALCdevice *device)
|
||||
{
|
||||
constexpr float Deg180{al::numbers::pi_v<float>};
|
||||
constexpr float Deg_90{Deg180 / 2.0f /* 90 degrees*/};
|
||||
constexpr float Deg_45{Deg_90 / 2.0f /* 45 degrees*/};
|
||||
constexpr float Deg135{Deg_45 * 3.0f /*135 degrees*/};
|
||||
constexpr float Deg_21{3.648638281e-01f /* 20~ 21 degrees*/};
|
||||
constexpr float Deg_32{5.535743589e-01f /* 31~ 32 degrees*/};
|
||||
constexpr float Deg_35{6.154797087e-01f /* 35~ 36 degrees*/};
|
||||
constexpr float Deg_58{1.017221968e+00f /* 58~ 59 degrees*/};
|
||||
constexpr float Deg_69{1.205932499e+00f /* 69~ 70 degrees*/};
|
||||
constexpr float Deg111{1.935660155e+00f /*110~111 degrees*/};
|
||||
constexpr float Deg122{2.124370686e+00f /*121~122 degrees*/};
|
||||
static const AngularPoint AmbiPoints1O[]{
|
||||
{ EvRadians{ Deg_35}, AzRadians{-Deg_45} },
|
||||
{ EvRadians{ Deg_35}, AzRadians{-Deg135} },
|
||||
{ EvRadians{ Deg_35}, AzRadians{ Deg_45} },
|
||||
{ EvRadians{ Deg_35}, AzRadians{ Deg135} },
|
||||
{ EvRadians{-Deg_35}, AzRadians{-Deg_45} },
|
||||
{ EvRadians{-Deg_35}, AzRadians{-Deg135} },
|
||||
{ EvRadians{-Deg_35}, AzRadians{ Deg_45} },
|
||||
{ EvRadians{-Deg_35}, AzRadians{ Deg135} },
|
||||
}, AmbiPoints2O[]{
|
||||
{ EvRadians{-Deg_32}, AzRadians{ 0.0f} },
|
||||
{ EvRadians{ 0.0f}, AzRadians{ Deg_58} },
|
||||
{ EvRadians{ Deg_58}, AzRadians{ Deg_90} },
|
||||
{ EvRadians{ Deg_32}, AzRadians{ 0.0f} },
|
||||
{ EvRadians{ 0.0f}, AzRadians{ Deg122} },
|
||||
{ EvRadians{-Deg_58}, AzRadians{-Deg_90} },
|
||||
{ EvRadians{-Deg_32}, AzRadians{ Deg180} },
|
||||
{ EvRadians{ 0.0f}, AzRadians{-Deg122} },
|
||||
{ EvRadians{ Deg_58}, AzRadians{-Deg_90} },
|
||||
{ EvRadians{ Deg_32}, AzRadians{ Deg180} },
|
||||
{ EvRadians{ 0.0f}, AzRadians{-Deg_58} },
|
||||
{ EvRadians{-Deg_58}, AzRadians{ Deg_90} },
|
||||
}, AmbiPoints3O[]{
|
||||
{ EvRadians{ Deg_69}, AzRadians{-Deg_90} },
|
||||
{ EvRadians{ Deg_69}, AzRadians{ Deg_90} },
|
||||
{ EvRadians{-Deg_69}, AzRadians{-Deg_90} },
|
||||
{ EvRadians{-Deg_69}, AzRadians{ Deg_90} },
|
||||
{ EvRadians{ 0.0f}, AzRadians{-Deg_69} },
|
||||
{ EvRadians{ 0.0f}, AzRadians{-Deg111} },
|
||||
{ EvRadians{ 0.0f}, AzRadians{ Deg_69} },
|
||||
{ EvRadians{ 0.0f}, AzRadians{ Deg111} },
|
||||
{ EvRadians{ Deg_21}, AzRadians{ 0.0f} },
|
||||
{ EvRadians{ Deg_21}, AzRadians{ Deg180} },
|
||||
{ EvRadians{-Deg_21}, AzRadians{ 0.0f} },
|
||||
{ EvRadians{-Deg_21}, AzRadians{ Deg180} },
|
||||
{ EvRadians{ Deg_35}, AzRadians{-Deg_45} },
|
||||
{ EvRadians{ Deg_35}, AzRadians{-Deg135} },
|
||||
{ EvRadians{ Deg_35}, AzRadians{ Deg_45} },
|
||||
{ EvRadians{ Deg_35}, AzRadians{ Deg135} },
|
||||
{ EvRadians{-Deg_35}, AzRadians{-Deg_45} },
|
||||
{ EvRadians{-Deg_35}, AzRadians{-Deg135} },
|
||||
{ EvRadians{-Deg_35}, AzRadians{ Deg_45} },
|
||||
{ EvRadians{-Deg_35}, AzRadians{ Deg135} },
|
||||
static constexpr float Deg180{al::numbers::pi_v<float>};
|
||||
static constexpr float Deg_90{Deg180 / 2.0f /* 90 degrees*/};
|
||||
static constexpr float Deg_45{Deg_90 / 2.0f /* 45 degrees*/};
|
||||
static constexpr float Deg135{Deg_45 * 3.0f /*135 degrees*/};
|
||||
static constexpr float Deg_21{3.648638281e-01f /* 20~ 21 degrees*/};
|
||||
static constexpr float Deg_32{5.535743589e-01f /* 31~ 32 degrees*/};
|
||||
static constexpr float Deg_35{6.154797087e-01f /* 35~ 36 degrees*/};
|
||||
static constexpr float Deg_58{1.017221968e+00f /* 58~ 59 degrees*/};
|
||||
static constexpr float Deg_69{1.205932499e+00f /* 69~ 70 degrees*/};
|
||||
static constexpr float Deg111{1.935660155e+00f /*110~111 degrees*/};
|
||||
static constexpr float Deg122{2.124370686e+00f /*121~122 degrees*/};
|
||||
static constexpr std::array AmbiPoints1O{
|
||||
AngularPoint{EvRadians{ Deg_35}, AzRadians{-Deg_45}},
|
||||
AngularPoint{EvRadians{ Deg_35}, AzRadians{-Deg135}},
|
||||
AngularPoint{EvRadians{ Deg_35}, AzRadians{ Deg_45}},
|
||||
AngularPoint{EvRadians{ Deg_35}, AzRadians{ Deg135}},
|
||||
AngularPoint{EvRadians{-Deg_35}, AzRadians{-Deg_45}},
|
||||
AngularPoint{EvRadians{-Deg_35}, AzRadians{-Deg135}},
|
||||
AngularPoint{EvRadians{-Deg_35}, AzRadians{ Deg_45}},
|
||||
AngularPoint{EvRadians{-Deg_35}, AzRadians{ Deg135}},
|
||||
};
|
||||
static const float AmbiMatrix1O[][MaxAmbiChannels]{
|
||||
{ 1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f },
|
||||
{ 1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f, -1.250000000e-01f },
|
||||
{ 1.250000000e-01f, -1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f },
|
||||
{ 1.250000000e-01f, -1.250000000e-01f, 1.250000000e-01f, -1.250000000e-01f },
|
||||
{ 1.250000000e-01f, 1.250000000e-01f, -1.250000000e-01f, 1.250000000e-01f },
|
||||
{ 1.250000000e-01f, 1.250000000e-01f, -1.250000000e-01f, -1.250000000e-01f },
|
||||
{ 1.250000000e-01f, -1.250000000e-01f, -1.250000000e-01f, 1.250000000e-01f },
|
||||
{ 1.250000000e-01f, -1.250000000e-01f, -1.250000000e-01f, -1.250000000e-01f },
|
||||
}, AmbiMatrix2O[][MaxAmbiChannels]{
|
||||
{ 8.333333333e-02f, 0.000000000e+00f, -7.588274978e-02f, 1.227808683e-01f, 0.000000000e+00f, 0.000000000e+00f, -1.591525047e-02f, -1.443375673e-01f, 1.167715449e-01f, },
|
||||
{ 8.333333333e-02f, -1.227808683e-01f, 0.000000000e+00f, 7.588274978e-02f, -1.443375673e-01f, 0.000000000e+00f, -9.316949906e-02f, 0.000000000e+00f, -7.216878365e-02f, },
|
||||
{ 8.333333333e-02f, -7.588274978e-02f, 1.227808683e-01f, 0.000000000e+00f, 0.000000000e+00f, -1.443375673e-01f, 1.090847495e-01f, 0.000000000e+00f, -4.460276122e-02f, },
|
||||
{ 8.333333333e-02f, 0.000000000e+00f, 7.588274978e-02f, 1.227808683e-01f, 0.000000000e+00f, 0.000000000e+00f, -1.591525047e-02f, 1.443375673e-01f, 1.167715449e-01f, },
|
||||
{ 8.333333333e-02f, -1.227808683e-01f, 0.000000000e+00f, -7.588274978e-02f, 1.443375673e-01f, 0.000000000e+00f, -9.316949906e-02f, 0.000000000e+00f, -7.216878365e-02f, },
|
||||
{ 8.333333333e-02f, 7.588274978e-02f, -1.227808683e-01f, 0.000000000e+00f, 0.000000000e+00f, -1.443375673e-01f, 1.090847495e-01f, 0.000000000e+00f, -4.460276122e-02f, },
|
||||
{ 8.333333333e-02f, 0.000000000e+00f, -7.588274978e-02f, -1.227808683e-01f, 0.000000000e+00f, 0.000000000e+00f, -1.591525047e-02f, 1.443375673e-01f, 1.167715449e-01f, },
|
||||
{ 8.333333333e-02f, 1.227808683e-01f, 0.000000000e+00f, -7.588274978e-02f, -1.443375673e-01f, 0.000000000e+00f, -9.316949906e-02f, 0.000000000e+00f, -7.216878365e-02f, },
|
||||
{ 8.333333333e-02f, 7.588274978e-02f, 1.227808683e-01f, 0.000000000e+00f, 0.000000000e+00f, 1.443375673e-01f, 1.090847495e-01f, 0.000000000e+00f, -4.460276122e-02f, },
|
||||
{ 8.333333333e-02f, 0.000000000e+00f, 7.588274978e-02f, -1.227808683e-01f, 0.000000000e+00f, 0.000000000e+00f, -1.591525047e-02f, -1.443375673e-01f, 1.167715449e-01f, },
|
||||
{ 8.333333333e-02f, 1.227808683e-01f, 0.000000000e+00f, 7.588274978e-02f, 1.443375673e-01f, 0.000000000e+00f, -9.316949906e-02f, 0.000000000e+00f, -7.216878365e-02f, },
|
||||
{ 8.333333333e-02f, -7.588274978e-02f, -1.227808683e-01f, 0.000000000e+00f, 0.000000000e+00f, 1.443375673e-01f, 1.090847495e-01f, 0.000000000e+00f, -4.460276122e-02f, },
|
||||
}, AmbiMatrix3O[][MaxAmbiChannels]{
|
||||
{ 5.000000000e-02f, 3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, 6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f, -1.256118221e-01f, 0.000000000e+00f, 1.126112056e-01f, 7.944389175e-02f, 0.000000000e+00f, 2.421151497e-02f, 0.000000000e+00f, },
|
||||
{ 5.000000000e-02f, -3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f, 1.256118221e-01f, 0.000000000e+00f, -1.126112056e-01f, 7.944389175e-02f, 0.000000000e+00f, 2.421151497e-02f, 0.000000000e+00f, },
|
||||
{ 5.000000000e-02f, 3.090169944e-02f, -8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f, -1.256118221e-01f, 0.000000000e+00f, 1.126112056e-01f, -7.944389175e-02f, 0.000000000e+00f, -2.421151497e-02f, 0.000000000e+00f, },
|
||||
{ 5.000000000e-02f, -3.090169944e-02f, -8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, 6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f, 1.256118221e-01f, 0.000000000e+00f, -1.126112056e-01f, -7.944389175e-02f, 0.000000000e+00f, -2.421151497e-02f, 0.000000000e+00f, },
|
||||
{ 5.000000000e-02f, 8.090169944e-02f, 0.000000000e+00f, 3.090169944e-02f, 6.454972244e-02f, 0.000000000e+00f, -5.590169944e-02f, 0.000000000e+00f, -7.216878365e-02f, -7.763237543e-02f, 0.000000000e+00f, -2.950836627e-02f, 0.000000000e+00f, -1.497759251e-01f, 0.000000000e+00f, -7.763237543e-02f, },
|
||||
{ 5.000000000e-02f, 8.090169944e-02f, 0.000000000e+00f, -3.090169944e-02f, -6.454972244e-02f, 0.000000000e+00f, -5.590169944e-02f, 0.000000000e+00f, -7.216878365e-02f, -7.763237543e-02f, 0.000000000e+00f, -2.950836627e-02f, 0.000000000e+00f, 1.497759251e-01f, 0.000000000e+00f, 7.763237543e-02f, },
|
||||
{ 5.000000000e-02f, -8.090169944e-02f, 0.000000000e+00f, 3.090169944e-02f, -6.454972244e-02f, 0.000000000e+00f, -5.590169944e-02f, 0.000000000e+00f, -7.216878365e-02f, 7.763237543e-02f, 0.000000000e+00f, 2.950836627e-02f, 0.000000000e+00f, -1.497759251e-01f, 0.000000000e+00f, -7.763237543e-02f, },
|
||||
{ 5.000000000e-02f, -8.090169944e-02f, 0.000000000e+00f, -3.090169944e-02f, 6.454972244e-02f, 0.000000000e+00f, -5.590169944e-02f, 0.000000000e+00f, -7.216878365e-02f, 7.763237543e-02f, 0.000000000e+00f, 2.950836627e-02f, 0.000000000e+00f, 1.497759251e-01f, 0.000000000e+00f, 7.763237543e-02f, },
|
||||
{ 5.000000000e-02f, 0.000000000e+00f, 3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -3.454915028e-02f, 6.454972244e-02f, 8.449668365e-02f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, 3.034486645e-02f, -6.779013272e-02f, 1.659481923e-01f, 4.797944664e-02f, },
|
||||
{ 5.000000000e-02f, 0.000000000e+00f, 3.090169944e-02f, -8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -3.454915028e-02f, -6.454972244e-02f, 8.449668365e-02f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, 3.034486645e-02f, 6.779013272e-02f, 1.659481923e-01f, -4.797944664e-02f, },
|
||||
{ 5.000000000e-02f, 0.000000000e+00f, -3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -3.454915028e-02f, -6.454972244e-02f, 8.449668365e-02f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, -3.034486645e-02f, -6.779013272e-02f, -1.659481923e-01f, 4.797944664e-02f, },
|
||||
{ 5.000000000e-02f, 0.000000000e+00f, -3.090169944e-02f, -8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -3.454915028e-02f, 6.454972244e-02f, 8.449668365e-02f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, -3.034486645e-02f, 6.779013272e-02f, -1.659481923e-01f, -4.797944664e-02f, },
|
||||
{ 5.000000000e-02f, 5.000000000e-02f, 5.000000000e-02f, 5.000000000e-02f, 6.454972244e-02f, 6.454972244e-02f, 0.000000000e+00f, 6.454972244e-02f, 0.000000000e+00f, 1.016220987e-01f, 6.338656910e-02f, -1.092600649e-02f, -7.364853795e-02f, 1.011266756e-01f, -7.086833869e-02f, -1.482646439e-02f, },
|
||||
{ 5.000000000e-02f, 5.000000000e-02f, 5.000000000e-02f, -5.000000000e-02f, -6.454972244e-02f, 6.454972244e-02f, 0.000000000e+00f, -6.454972244e-02f, 0.000000000e+00f, 1.016220987e-01f, -6.338656910e-02f, -1.092600649e-02f, -7.364853795e-02f, -1.011266756e-01f, -7.086833869e-02f, 1.482646439e-02f, },
|
||||
{ 5.000000000e-02f, -5.000000000e-02f, 5.000000000e-02f, 5.000000000e-02f, -6.454972244e-02f, -6.454972244e-02f, 0.000000000e+00f, 6.454972244e-02f, 0.000000000e+00f, -1.016220987e-01f, -6.338656910e-02f, 1.092600649e-02f, -7.364853795e-02f, 1.011266756e-01f, -7.086833869e-02f, -1.482646439e-02f, },
|
||||
{ 5.000000000e-02f, -5.000000000e-02f, 5.000000000e-02f, -5.000000000e-02f, 6.454972244e-02f, -6.454972244e-02f, 0.000000000e+00f, -6.454972244e-02f, 0.000000000e+00f, -1.016220987e-01f, 6.338656910e-02f, 1.092600649e-02f, -7.364853795e-02f, -1.011266756e-01f, -7.086833869e-02f, 1.482646439e-02f, },
|
||||
{ 5.000000000e-02f, 5.000000000e-02f, -5.000000000e-02f, 5.000000000e-02f, 6.454972244e-02f, -6.454972244e-02f, 0.000000000e+00f, -6.454972244e-02f, 0.000000000e+00f, 1.016220987e-01f, -6.338656910e-02f, -1.092600649e-02f, 7.364853795e-02f, 1.011266756e-01f, 7.086833869e-02f, -1.482646439e-02f, },
|
||||
{ 5.000000000e-02f, 5.000000000e-02f, -5.000000000e-02f, -5.000000000e-02f, -6.454972244e-02f, -6.454972244e-02f, 0.000000000e+00f, 6.454972244e-02f, 0.000000000e+00f, 1.016220987e-01f, 6.338656910e-02f, -1.092600649e-02f, 7.364853795e-02f, -1.011266756e-01f, 7.086833869e-02f, 1.482646439e-02f, },
|
||||
{ 5.000000000e-02f, -5.000000000e-02f, -5.000000000e-02f, 5.000000000e-02f, -6.454972244e-02f, 6.454972244e-02f, 0.000000000e+00f, -6.454972244e-02f, 0.000000000e+00f, -1.016220987e-01f, 6.338656910e-02f, 1.092600649e-02f, 7.364853795e-02f, 1.011266756e-01f, 7.086833869e-02f, -1.482646439e-02f, },
|
||||
{ 5.000000000e-02f, -5.000000000e-02f, -5.000000000e-02f, -5.000000000e-02f, 6.454972244e-02f, 6.454972244e-02f, 0.000000000e+00f, 6.454972244e-02f, 0.000000000e+00f, -1.016220987e-01f, -6.338656910e-02f, 1.092600649e-02f, 7.364853795e-02f, -1.011266756e-01f, 7.086833869e-02f, 1.482646439e-02f, },
|
||||
static constexpr std::array AmbiPoints2O{
|
||||
AngularPoint{EvRadians{-Deg_32}, AzRadians{ 0.0f}},
|
||||
AngularPoint{EvRadians{ 0.0f}, AzRadians{ Deg_58}},
|
||||
AngularPoint{EvRadians{ Deg_58}, AzRadians{ Deg_90}},
|
||||
AngularPoint{EvRadians{ Deg_32}, AzRadians{ 0.0f}},
|
||||
AngularPoint{EvRadians{ 0.0f}, AzRadians{ Deg122}},
|
||||
AngularPoint{EvRadians{-Deg_58}, AzRadians{-Deg_90}},
|
||||
AngularPoint{EvRadians{-Deg_32}, AzRadians{ Deg180}},
|
||||
AngularPoint{EvRadians{ 0.0f}, AzRadians{-Deg122}},
|
||||
AngularPoint{EvRadians{ Deg_58}, AzRadians{-Deg_90}},
|
||||
AngularPoint{EvRadians{ Deg_32}, AzRadians{ Deg180}},
|
||||
AngularPoint{EvRadians{ 0.0f}, AzRadians{-Deg_58}},
|
||||
AngularPoint{EvRadians{-Deg_58}, AzRadians{ Deg_90}},
|
||||
};
|
||||
static const float AmbiOrderHFGain1O[MaxAmbiOrder+1]{
|
||||
static constexpr std::array AmbiPoints3O{
|
||||
AngularPoint{EvRadians{ Deg_69}, AzRadians{-Deg_90}},
|
||||
AngularPoint{EvRadians{ Deg_69}, AzRadians{ Deg_90}},
|
||||
AngularPoint{EvRadians{-Deg_69}, AzRadians{-Deg_90}},
|
||||
AngularPoint{EvRadians{-Deg_69}, AzRadians{ Deg_90}},
|
||||
AngularPoint{EvRadians{ 0.0f}, AzRadians{-Deg_69}},
|
||||
AngularPoint{EvRadians{ 0.0f}, AzRadians{-Deg111}},
|
||||
AngularPoint{EvRadians{ 0.0f}, AzRadians{ Deg_69}},
|
||||
AngularPoint{EvRadians{ 0.0f}, AzRadians{ Deg111}},
|
||||
AngularPoint{EvRadians{ Deg_21}, AzRadians{ 0.0f}},
|
||||
AngularPoint{EvRadians{ Deg_21}, AzRadians{ Deg180}},
|
||||
AngularPoint{EvRadians{-Deg_21}, AzRadians{ 0.0f}},
|
||||
AngularPoint{EvRadians{-Deg_21}, AzRadians{ Deg180}},
|
||||
AngularPoint{EvRadians{ Deg_35}, AzRadians{-Deg_45}},
|
||||
AngularPoint{EvRadians{ Deg_35}, AzRadians{-Deg135}},
|
||||
AngularPoint{EvRadians{ Deg_35}, AzRadians{ Deg_45}},
|
||||
AngularPoint{EvRadians{ Deg_35}, AzRadians{ Deg135}},
|
||||
AngularPoint{EvRadians{-Deg_35}, AzRadians{-Deg_45}},
|
||||
AngularPoint{EvRadians{-Deg_35}, AzRadians{-Deg135}},
|
||||
AngularPoint{EvRadians{-Deg_35}, AzRadians{ Deg_45}},
|
||||
AngularPoint{EvRadians{-Deg_35}, AzRadians{ Deg135}},
|
||||
};
|
||||
static constexpr std::array AmbiMatrix1O{
|
||||
std::array<float,MaxAmbiChannels>{{1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f}},
|
||||
std::array<float,MaxAmbiChannels>{{1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f, -1.250000000e-01f}},
|
||||
std::array<float,MaxAmbiChannels>{{1.250000000e-01f, -1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f}},
|
||||
std::array<float,MaxAmbiChannels>{{1.250000000e-01f, -1.250000000e-01f, 1.250000000e-01f, -1.250000000e-01f}},
|
||||
std::array<float,MaxAmbiChannels>{{1.250000000e-01f, 1.250000000e-01f, -1.250000000e-01f, 1.250000000e-01f}},
|
||||
std::array<float,MaxAmbiChannels>{{1.250000000e-01f, 1.250000000e-01f, -1.250000000e-01f, -1.250000000e-01f}},
|
||||
std::array<float,MaxAmbiChannels>{{1.250000000e-01f, -1.250000000e-01f, -1.250000000e-01f, 1.250000000e-01f}},
|
||||
std::array<float,MaxAmbiChannels>{{1.250000000e-01f, -1.250000000e-01f, -1.250000000e-01f, -1.250000000e-01f}},
|
||||
};
|
||||
static constexpr std::array AmbiMatrix2O{
|
||||
std::array<float,MaxAmbiChannels>{{8.333333333e-02f, 0.000000000e+00f, -7.588274978e-02f, 1.227808683e-01f, 0.000000000e+00f, 0.000000000e+00f, -1.591525047e-02f, -1.443375673e-01f, 1.167715449e-01f}},
|
||||
std::array<float,MaxAmbiChannels>{{8.333333333e-02f, -1.227808683e-01f, 0.000000000e+00f, 7.588274978e-02f, -1.443375673e-01f, 0.000000000e+00f, -9.316949906e-02f, 0.000000000e+00f, -7.216878365e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{8.333333333e-02f, -7.588274978e-02f, 1.227808683e-01f, 0.000000000e+00f, 0.000000000e+00f, -1.443375673e-01f, 1.090847495e-01f, 0.000000000e+00f, -4.460276122e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{8.333333333e-02f, 0.000000000e+00f, 7.588274978e-02f, 1.227808683e-01f, 0.000000000e+00f, 0.000000000e+00f, -1.591525047e-02f, 1.443375673e-01f, 1.167715449e-01f}},
|
||||
std::array<float,MaxAmbiChannels>{{8.333333333e-02f, -1.227808683e-01f, 0.000000000e+00f, -7.588274978e-02f, 1.443375673e-01f, 0.000000000e+00f, -9.316949906e-02f, 0.000000000e+00f, -7.216878365e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{8.333333333e-02f, 7.588274978e-02f, -1.227808683e-01f, 0.000000000e+00f, 0.000000000e+00f, -1.443375673e-01f, 1.090847495e-01f, 0.000000000e+00f, -4.460276122e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{8.333333333e-02f, 0.000000000e+00f, -7.588274978e-02f, -1.227808683e-01f, 0.000000000e+00f, 0.000000000e+00f, -1.591525047e-02f, 1.443375673e-01f, 1.167715449e-01f}},
|
||||
std::array<float,MaxAmbiChannels>{{8.333333333e-02f, 1.227808683e-01f, 0.000000000e+00f, -7.588274978e-02f, -1.443375673e-01f, 0.000000000e+00f, -9.316949906e-02f, 0.000000000e+00f, -7.216878365e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{8.333333333e-02f, 7.588274978e-02f, 1.227808683e-01f, 0.000000000e+00f, 0.000000000e+00f, 1.443375673e-01f, 1.090847495e-01f, 0.000000000e+00f, -4.460276122e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{8.333333333e-02f, 0.000000000e+00f, 7.588274978e-02f, -1.227808683e-01f, 0.000000000e+00f, 0.000000000e+00f, -1.591525047e-02f, -1.443375673e-01f, 1.167715449e-01f}},
|
||||
std::array<float,MaxAmbiChannels>{{8.333333333e-02f, 1.227808683e-01f, 0.000000000e+00f, 7.588274978e-02f, 1.443375673e-01f, 0.000000000e+00f, -9.316949906e-02f, 0.000000000e+00f, -7.216878365e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{8.333333333e-02f, -7.588274978e-02f, -1.227808683e-01f, 0.000000000e+00f, 0.000000000e+00f, 1.443375673e-01f, 1.090847495e-01f, 0.000000000e+00f, -4.460276122e-02f}},
|
||||
};
|
||||
static constexpr std::array AmbiMatrix3O{
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, 3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, 6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f, -1.256118221e-01f, 0.000000000e+00f, 1.126112056e-01f, 7.944389175e-02f, 0.000000000e+00f, 2.421151497e-02f, 0.000000000e+00f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, -3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f, 1.256118221e-01f, 0.000000000e+00f, -1.126112056e-01f, 7.944389175e-02f, 0.000000000e+00f, 2.421151497e-02f, 0.000000000e+00f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, 3.090169944e-02f, -8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f, -1.256118221e-01f, 0.000000000e+00f, 1.126112056e-01f, -7.944389175e-02f, 0.000000000e+00f, -2.421151497e-02f, 0.000000000e+00f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, -3.090169944e-02f, -8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, 6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f, 1.256118221e-01f, 0.000000000e+00f, -1.126112056e-01f, -7.944389175e-02f, 0.000000000e+00f, -2.421151497e-02f, 0.000000000e+00f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, 8.090169944e-02f, 0.000000000e+00f, 3.090169944e-02f, 6.454972244e-02f, 0.000000000e+00f, -5.590169944e-02f, 0.000000000e+00f, -7.216878365e-02f, -7.763237543e-02f, 0.000000000e+00f, -2.950836627e-02f, 0.000000000e+00f, -1.497759251e-01f, 0.000000000e+00f, -7.763237543e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, 8.090169944e-02f, 0.000000000e+00f, -3.090169944e-02f, -6.454972244e-02f, 0.000000000e+00f, -5.590169944e-02f, 0.000000000e+00f, -7.216878365e-02f, -7.763237543e-02f, 0.000000000e+00f, -2.950836627e-02f, 0.000000000e+00f, 1.497759251e-01f, 0.000000000e+00f, 7.763237543e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, -8.090169944e-02f, 0.000000000e+00f, 3.090169944e-02f, -6.454972244e-02f, 0.000000000e+00f, -5.590169944e-02f, 0.000000000e+00f, -7.216878365e-02f, 7.763237543e-02f, 0.000000000e+00f, 2.950836627e-02f, 0.000000000e+00f, -1.497759251e-01f, 0.000000000e+00f, -7.763237543e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, -8.090169944e-02f, 0.000000000e+00f, -3.090169944e-02f, 6.454972244e-02f, 0.000000000e+00f, -5.590169944e-02f, 0.000000000e+00f, -7.216878365e-02f, 7.763237543e-02f, 0.000000000e+00f, 2.950836627e-02f, 0.000000000e+00f, 1.497759251e-01f, 0.000000000e+00f, 7.763237543e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, 0.000000000e+00f, 3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -3.454915028e-02f, 6.454972244e-02f, 8.449668365e-02f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, 3.034486645e-02f, -6.779013272e-02f, 1.659481923e-01f, 4.797944664e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, 0.000000000e+00f, 3.090169944e-02f, -8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -3.454915028e-02f, -6.454972244e-02f, 8.449668365e-02f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, 3.034486645e-02f, 6.779013272e-02f, 1.659481923e-01f, -4.797944664e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, 0.000000000e+00f, -3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -3.454915028e-02f, -6.454972244e-02f, 8.449668365e-02f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, -3.034486645e-02f, -6.779013272e-02f, -1.659481923e-01f, 4.797944664e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, 0.000000000e+00f, -3.090169944e-02f, -8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -3.454915028e-02f, 6.454972244e-02f, 8.449668365e-02f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, -3.034486645e-02f, 6.779013272e-02f, -1.659481923e-01f, -4.797944664e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, 5.000000000e-02f, 5.000000000e-02f, 5.000000000e-02f, 6.454972244e-02f, 6.454972244e-02f, 0.000000000e+00f, 6.454972244e-02f, 0.000000000e+00f, 1.016220987e-01f, 6.338656910e-02f, -1.092600649e-02f, -7.364853795e-02f, 1.011266756e-01f, -7.086833869e-02f, -1.482646439e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, 5.000000000e-02f, 5.000000000e-02f, -5.000000000e-02f, -6.454972244e-02f, 6.454972244e-02f, 0.000000000e+00f, -6.454972244e-02f, 0.000000000e+00f, 1.016220987e-01f, -6.338656910e-02f, -1.092600649e-02f, -7.364853795e-02f, -1.011266756e-01f, -7.086833869e-02f, 1.482646439e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, -5.000000000e-02f, 5.000000000e-02f, 5.000000000e-02f, -6.454972244e-02f, -6.454972244e-02f, 0.000000000e+00f, 6.454972244e-02f, 0.000000000e+00f, -1.016220987e-01f, -6.338656910e-02f, 1.092600649e-02f, -7.364853795e-02f, 1.011266756e-01f, -7.086833869e-02f, -1.482646439e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, -5.000000000e-02f, 5.000000000e-02f, -5.000000000e-02f, 6.454972244e-02f, -6.454972244e-02f, 0.000000000e+00f, -6.454972244e-02f, 0.000000000e+00f, -1.016220987e-01f, 6.338656910e-02f, 1.092600649e-02f, -7.364853795e-02f, -1.011266756e-01f, -7.086833869e-02f, 1.482646439e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, 5.000000000e-02f, -5.000000000e-02f, 5.000000000e-02f, 6.454972244e-02f, -6.454972244e-02f, 0.000000000e+00f, -6.454972244e-02f, 0.000000000e+00f, 1.016220987e-01f, -6.338656910e-02f, -1.092600649e-02f, 7.364853795e-02f, 1.011266756e-01f, 7.086833869e-02f, -1.482646439e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, 5.000000000e-02f, -5.000000000e-02f, -5.000000000e-02f, -6.454972244e-02f, -6.454972244e-02f, 0.000000000e+00f, 6.454972244e-02f, 0.000000000e+00f, 1.016220987e-01f, 6.338656910e-02f, -1.092600649e-02f, 7.364853795e-02f, -1.011266756e-01f, 7.086833869e-02f, 1.482646439e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, -5.000000000e-02f, -5.000000000e-02f, 5.000000000e-02f, -6.454972244e-02f, 6.454972244e-02f, 0.000000000e+00f, -6.454972244e-02f, 0.000000000e+00f, -1.016220987e-01f, 6.338656910e-02f, 1.092600649e-02f, 7.364853795e-02f, 1.011266756e-01f, 7.086833869e-02f, -1.482646439e-02f}},
|
||||
std::array<float,MaxAmbiChannels>{{5.000000000e-02f, -5.000000000e-02f, -5.000000000e-02f, -5.000000000e-02f, 6.454972244e-02f, 6.454972244e-02f, 0.000000000e+00f, 6.454972244e-02f, 0.000000000e+00f, -1.016220987e-01f, -6.338656910e-02f, 1.092600649e-02f, 7.364853795e-02f, -1.011266756e-01f, 7.086833869e-02f, 1.482646439e-02f}},
|
||||
};
|
||||
static constexpr std::array<float,MaxAmbiOrder+1> AmbiOrderHFGain1O{
|
||||
/*ENRGY*/ 2.000000000e+00f, 1.154700538e+00f
|
||||
}, AmbiOrderHFGain2O[MaxAmbiOrder+1]{
|
||||
};
|
||||
static constexpr std::array<float,MaxAmbiOrder+1> AmbiOrderHFGain2O{
|
||||
/*ENRGY*/ 1.825741858e+00f, 1.414213562e+00f, 7.302967433e-01f
|
||||
/*AMP 1.000000000e+00f, 7.745966692e-01f, 4.000000000e-01f*/
|
||||
/*RMS 9.128709292e-01f, 7.071067812e-01f, 3.651483717e-01f*/
|
||||
}, AmbiOrderHFGain3O[MaxAmbiOrder+1]{
|
||||
};
|
||||
static constexpr std::array<float,MaxAmbiOrder+1> AmbiOrderHFGain3O{
|
||||
/*ENRGY 1.865086714e+00f, 1.606093894e+00f, 1.142055301e+00f, 5.683795528e-01f*/
|
||||
/*AMP*/ 1.000000000e+00f, 8.611363116e-01f, 6.123336207e-01f, 3.047469850e-01f
|
||||
/*RMS 8.340921354e-01f, 7.182670250e-01f, 5.107426573e-01f, 2.541870634e-01f*/
|
||||
};
|
||||
|
||||
static_assert(std::size(AmbiPoints1O) == std::size(AmbiMatrix1O), "First-Order Ambisonic HRTF mismatch");
|
||||
static_assert(std::size(AmbiPoints2O) == std::size(AmbiMatrix2O), "Second-Order Ambisonic HRTF mismatch");
|
||||
static_assert(std::size(AmbiPoints3O) == std::size(AmbiMatrix3O), "Third-Order Ambisonic HRTF mismatch");
|
||||
static_assert(AmbiPoints1O.size() == AmbiMatrix1O.size(), "First-Order Ambisonic HRTF mismatch");
|
||||
static_assert(AmbiPoints2O.size() == AmbiMatrix2O.size(), "Second-Order Ambisonic HRTF mismatch");
|
||||
static_assert(AmbiPoints3O.size() == AmbiMatrix3O.size(), "Third-Order Ambisonic HRTF mismatch");
|
||||
|
||||
/* A 700hz crossover frequency provides tighter sound imaging at the sweet
|
||||
* spot with ambisonic decoding, as the distance between the ears is closer
|
||||
@@ -844,15 +849,15 @@ void InitHrtfPanning(ALCdevice *device)
|
||||
if(auto modeopt = device->configValue<std::string>(nullptr, "hrtf-mode"))
|
||||
{
|
||||
struct HrtfModeEntry {
|
||||
char name[8];
|
||||
char name[7]; /* NOLINT(*-avoid-c-arrays) */
|
||||
RenderMode mode;
|
||||
uint order;
|
||||
};
|
||||
static const HrtfModeEntry hrtf_modes[]{
|
||||
{ "full", RenderMode::Hrtf, 1 },
|
||||
{ "ambi1", RenderMode::Normal, 1 },
|
||||
{ "ambi2", RenderMode::Normal, 2 },
|
||||
{ "ambi3", RenderMode::Normal, 3 },
|
||||
static constexpr std::array hrtf_modes{
|
||||
HrtfModeEntry{"full", RenderMode::Hrtf, 1},
|
||||
HrtfModeEntry{"ambi1", RenderMode::Normal, 1},
|
||||
HrtfModeEntry{"ambi2", RenderMode::Normal, 2},
|
||||
HrtfModeEntry{"ambi3", RenderMode::Normal, 3},
|
||||
};
|
||||
|
||||
const char *mode{modeopt->c_str()};
|
||||
@@ -882,9 +887,9 @@ void InitHrtfPanning(ALCdevice *device)
|
||||
device->mHrtfName.c_str());
|
||||
|
||||
bool perHrirMin{false};
|
||||
al::span<const AngularPoint> AmbiPoints{AmbiPoints1O};
|
||||
const float (*AmbiMatrix)[MaxAmbiChannels]{AmbiMatrix1O};
|
||||
al::span<const float,MaxAmbiOrder+1> AmbiOrderHFGain{AmbiOrderHFGain1O};
|
||||
auto AmbiPoints = al::span{AmbiPoints1O}.subspan(0);
|
||||
auto AmbiMatrix = al::span{AmbiMatrix1O}.subspan(0);
|
||||
auto AmbiOrderHFGain = al::span{AmbiOrderHFGain1O};
|
||||
if(ambi_order >= 3)
|
||||
{
|
||||
perHrirMin = true;
|
||||
@@ -903,7 +908,7 @@ void InitHrtfPanning(ALCdevice *device)
|
||||
|
||||
const size_t count{AmbiChannelsFromOrder(ambi_order)};
|
||||
std::transform(AmbiIndex::FromACN.begin(), AmbiIndex::FromACN.begin()+count,
|
||||
std::begin(device->Dry.AmbiMap),
|
||||
device->Dry.AmbiMap.begin(),
|
||||
[](const uint8_t &index) noexcept { return BFChannelConfig{1.0f, index}; }
|
||||
);
|
||||
AllocChannels(device, count, device->channelsFromFmt());
|
||||
@@ -981,9 +986,9 @@ void aluInitRenderer(ALCdevice *device, int hrtf_id, std::optional<StereoEncodin
|
||||
ERR(" %s\n", err->c_str());
|
||||
return false;
|
||||
}
|
||||
else if(conf.NumSpeakers > MaxOutputChannels)
|
||||
else if(conf.Speakers.size() > MaxOutputChannels)
|
||||
{
|
||||
ERR("Unsupported decoder speaker count %zu (max %zu)\n", conf.NumSpeakers,
|
||||
ERR("Unsupported decoder speaker count %zu (max %zu)\n", conf.Speakers.size(),
|
||||
MaxOutputChannels);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <array>
|
||||
#include <stddef.h>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include "alcomplex.h"
|
||||
#include "alspan.h"
|
||||
@@ -52,20 +53,19 @@ struct PhaseShifterT {
|
||||
constexpr size_t fft_size{FilterSize};
|
||||
constexpr size_t half_size{fft_size / 2};
|
||||
|
||||
auto fftBuffer = std::make_unique<complex_d[]>(fft_size);
|
||||
std::fill_n(fftBuffer.get(), fft_size, complex_d{});
|
||||
auto fftBuffer = std::vector<complex_d>(fft_size, complex_d{});
|
||||
fftBuffer[half_size] = 1.0;
|
||||
|
||||
forward_fft(al::span{fftBuffer.get(), fft_size});
|
||||
forward_fft(al::span{fftBuffer});
|
||||
fftBuffer[0] *= std::numeric_limits<double>::epsilon();
|
||||
for(size_t i{1};i < half_size;++i)
|
||||
fftBuffer[i] = complex_d{-fftBuffer[i].imag(), fftBuffer[i].real()};
|
||||
fftBuffer[half_size] *= std::numeric_limits<double>::epsilon();
|
||||
for(size_t i{half_size+1};i < fft_size;++i)
|
||||
fftBuffer[i] = std::conj(fftBuffer[fft_size - i]);
|
||||
inverse_fft(al::span{fftBuffer.get(), fft_size});
|
||||
inverse_fft(al::span{fftBuffer});
|
||||
|
||||
auto fftiter = fftBuffer.get() + fft_size - 1;
|
||||
auto fftiter = fftBuffer.data() + fft_size - 1;
|
||||
for(float &coeff : mCoeffs)
|
||||
{
|
||||
coeff = static_cast<float>(fftiter->real() / double{fft_size});
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <climits>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "almalloc.h"
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ std::optional<std::string> AmbDecConf::load(const char *fname) noexcept
|
||||
{
|
||||
if(command == "add_spkr")
|
||||
{
|
||||
if(speaker_pos == NumSpeakers)
|
||||
if(speaker_pos == Speakers.size())
|
||||
return make_error(linenum, "Too many speakers specified");
|
||||
|
||||
AmbDecConf::SpeakerConf &spkr = Speakers[speaker_pos++];
|
||||
@@ -145,7 +145,7 @@ std::optional<std::string> AmbDecConf::load(const char *fname) noexcept
|
||||
}
|
||||
else if(command == "add_row")
|
||||
{
|
||||
if(pos == NumSpeakers)
|
||||
if(pos == Speakers.size())
|
||||
return make_error(linenum, "Too many matrix rows specified");
|
||||
|
||||
unsigned int mask{ChanMask};
|
||||
@@ -205,12 +205,13 @@ std::optional<std::string> AmbDecConf::load(const char *fname) noexcept
|
||||
}
|
||||
else if(command == "/dec/speakers")
|
||||
{
|
||||
if(NumSpeakers)
|
||||
if(!Speakers.empty())
|
||||
return make_error(linenum, "Duplicate speakers");
|
||||
istr >> NumSpeakers;
|
||||
if(!NumSpeakers)
|
||||
return make_error(linenum, "Invalid speakers: %zu", NumSpeakers);
|
||||
Speakers = std::make_unique<SpeakerConf[]>(NumSpeakers);
|
||||
size_t numspeakers{};
|
||||
istr >> numspeakers;
|
||||
if(!numspeakers)
|
||||
return make_error(linenum, "Invalid speakers: %zu", numspeakers);
|
||||
Speakers.resize(numspeakers);
|
||||
}
|
||||
else if(command == "/dec/coeff_scale")
|
||||
{
|
||||
@@ -243,22 +244,22 @@ std::optional<std::string> AmbDecConf::load(const char *fname) noexcept
|
||||
}
|
||||
else if(command == "/speakers/{")
|
||||
{
|
||||
if(!NumSpeakers)
|
||||
if(Speakers.empty())
|
||||
return make_error(linenum, "Speakers defined without a count");
|
||||
scope = ReaderScope::Speakers;
|
||||
}
|
||||
else if(command == "/lfmatrix/{" || command == "/hfmatrix/{" || command == "/matrix/{")
|
||||
{
|
||||
if(!NumSpeakers)
|
||||
if(Speakers.empty())
|
||||
return make_error(linenum, "Matrix defined without a speaker count");
|
||||
if(!ChanMask)
|
||||
return make_error(linenum, "Matrix defined without a channel mask");
|
||||
|
||||
if(!Matrix)
|
||||
if(Matrix.empty())
|
||||
{
|
||||
Matrix = std::make_unique<CoeffArray[]>(NumSpeakers * FreqBands);
|
||||
LFMatrix = Matrix.get();
|
||||
HFMatrix = LFMatrix + NumSpeakers*(FreqBands-1);
|
||||
Matrix.resize(Speakers.size() * FreqBands);
|
||||
LFMatrix = Matrix.data();
|
||||
HFMatrix = LFMatrix + Speakers.size()*(FreqBands-1);
|
||||
}
|
||||
|
||||
if(FreqBands == 1)
|
||||
@@ -285,8 +286,8 @@ std::optional<std::string> AmbDecConf::load(const char *fname) noexcept
|
||||
if(!is_at_end(buffer, endpos))
|
||||
return make_error(linenum, "Extra junk on end: %s", buffer.substr(endpos).c_str());
|
||||
|
||||
if(speaker_pos < NumSpeakers || hfmatrix_pos < NumSpeakers
|
||||
|| (FreqBands == 2 && lfmatrix_pos < NumSpeakers))
|
||||
if(speaker_pos < Speakers.empty() || hfmatrix_pos < Speakers.empty()
|
||||
|| (FreqBands == 2 && lfmatrix_pos < Speakers.empty()))
|
||||
return make_error(linenum, "Incomplete decoder definition");
|
||||
if(CoeffScale == AmbDecScale::Unset)
|
||||
return make_error(linenum, "No coefficient scaling defined");
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "core/ambidefs.h"
|
||||
|
||||
@@ -34,17 +35,16 @@ struct AmbDecConf {
|
||||
float Elevation{0.0f};
|
||||
std::string Connection;
|
||||
};
|
||||
size_t NumSpeakers{0};
|
||||
std::unique_ptr<SpeakerConf[]> Speakers;
|
||||
std::vector<SpeakerConf> Speakers;
|
||||
|
||||
using CoeffArray = std::array<float,MaxAmbiChannels>;
|
||||
std::unique_ptr<CoeffArray[]> Matrix;
|
||||
std::vector<CoeffArray> Matrix;
|
||||
|
||||
/* Unused when FreqBands == 1 */
|
||||
float LFOrderGain[MaxAmbiOrder+1]{};
|
||||
std::array<float,MaxAmbiOrder+1> LFOrderGain{};
|
||||
CoeffArray *LFMatrix;
|
||||
|
||||
float HFOrderGain[MaxAmbiOrder+1]{};
|
||||
std::array<float,MaxAmbiOrder+1> HFOrderGain{};
|
||||
CoeffArray *HFMatrix;
|
||||
|
||||
~AmbDecConf();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user