diff options
author | Chris Robinson <chris.kcat@gmail.com> | 2019-10-25 01:43:23 -0700 |
---|---|---|
committer | Chris Robinson <chris.kcat@gmail.com> | 2019-10-25 01:43:23 -0700 |
commit | 0cba99ed1bc2712c15c17f0940127e6f84395729 (patch) | |
tree | c5898dc9022da86450204f71579723c41d54bc92 /alc | |
parent | 5ac1f192419a5d1d435a0f8703560823075799af (diff) |
Avoid static constexpr for arrays iterated over at run-time
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alc.cpp | 6 | ||||
-rw-r--r-- | alc/alu.cpp | 2 | ||||
-rw-r--r-- | alc/helpers.cpp | 2 | ||||
-rw-r--r-- | alc/hrtf.cpp | 6 | ||||
-rw-r--r-- | alc/panning.cpp | 20 |
5 files changed, 18 insertions, 18 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 7702a147..cd2911f5 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -1988,7 +1988,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) * constexpr variable to avoid a reference on * FrontStablizer::DelayLength... */ - static constexpr size_t StablizerDelay{FrontStablizer::DelayLength}; + constexpr size_t StablizerDelay{FrontStablizer::DelayLength}; device->FixedLatency += nanoseconds{seconds{StablizerDelay}} / device->Frequency; } break; @@ -3568,7 +3568,7 @@ START_API_FUNC deviceName = device->DeviceName.c_str(); if(auto chanopt = ConfigValueStr(deviceName, nullptr, "channels")) { - static constexpr struct ChannelMap { + static const struct ChannelMap { const char name[16]; DevFmtChannels chans; ALuint order; @@ -3601,7 +3601,7 @@ START_API_FUNC } if(auto typeopt = ConfigValueStr(deviceName, nullptr, "sample-type")) { - static constexpr struct TypeMap { + static const struct TypeMap { const char name[16]; DevFmtType type; } typelist[] = { diff --git a/alc/alu.cpp b/alc/alu.cpp index 5cd8c918..9bf052e1 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -509,7 +509,7 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat xpos, const ALfloat ypo ALeffectslot *(&SendSlots)[MAX_SENDS], const ALvoicePropsBase *props, const ALlistener &Listener, const ALCdevice *Device) { - static constexpr ChanMap MonoMap[1]{ + static const ChanMap MonoMap[1]{ { FrontCenter, 0.0f, 0.0f } }, RearMap[2]{ { BackLeft, Deg2Rad(-150.0f), Deg2Rad(0.0f) }, diff --git a/alc/helpers.cpp b/alc/helpers.cpp index 25b2e4a2..4ea94c7d 100644 --- a/alc/helpers.cpp +++ b/alc/helpers.cpp @@ -385,7 +385,7 @@ al::vector<std::string> SearchDataFiles(const char *ext, const char *subdir) DirectorySearch(path.c_str(), ext, &results); /* Search the local and global data dirs. */ - static constexpr int ids[2]{ CSIDL_APPDATA, CSIDL_COMMON_APPDATA }; + static const int ids[2]{ CSIDL_APPDATA, CSIDL_COMMON_APPDATA }; for(int id : ids) { WCHAR buffer[MAX_PATH]; diff --git a/alc/hrtf.cpp b/alc/hrtf.cpp index fa0085ff..c22848d6 100644 --- a/alc/hrtf.cpp +++ b/alc/hrtf.cpp @@ -300,7 +300,7 @@ void BuildBFormatHrtf(const HrtfEntry *Hrtf, DirectHrtfState *state, ALuint ldelay, rdelay; }; - static constexpr int OrderFromChan[MAX_AMBI_CHANNELS]{ + static const int OrderFromChan[MAX_AMBI_CHANNELS]{ 0, 1,1,1, 2,2,2,2,2, 3,3,3,3,3,3,3, }; /* Set this to true for dual-band HRTF processing. May require better @@ -718,7 +718,7 @@ std::unique_ptr<HrtfEntry> LoadHrtf00(std::istream &data, const char *filename) } } - static constexpr ALfloat distance{0.0f}; + static const ALfloat distance{0.0f}; return CreateHrtfStore(rate, irSize, 1, &evCount, &distance, azCount.data(), evOffset.data(), irCount, &reinterpret_cast<ALfloat(&)[2]>(coeffs[0]), &reinterpret_cast<ALubyte(&)[2]>(delays[0]), filename); @@ -817,7 +817,7 @@ std::unique_ptr<HrtfEntry> LoadHrtf01(std::istream &data, const char *filename) } } - static constexpr ALfloat distance{0.0f}; + static const ALfloat distance{0.0f}; return CreateHrtfStore(rate, irSize, 1, &evCount, &distance, azCount.data(), evOffset.data(), irCount, &reinterpret_cast<ALfloat(&)[2]>(coeffs[0]), &reinterpret_cast<ALubyte(&)[2]>(delays[0]), filename); diff --git a/alc/panning.cpp b/alc/panning.cpp index aa30a71c..6056b9d9 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -423,7 +423,7 @@ void InitPanning(ALCdevice *device) ALfloat nfc_delay{ConfigValueFloat(devname, "decoder", "nfc-ref-delay").value_or(0.0f)}; if(nfc_delay > 0.0f) { - static constexpr ALuint chans_per_order[MAX_AMBI_ORDER+1]{ 1, 3, 5, 7 }; + static const ALuint chans_per_order[MAX_AMBI_ORDER+1]{ 1, 3, 5, 7 }; InitNearFieldCtrl(device, nfc_delay * SPEEDOFSOUNDMETRESPERSEC, device->mAmbiOrder, chans_per_order); } @@ -470,8 +470,8 @@ void InitPanning(ALCdevice *device) void InitCustomPanning(ALCdevice *device, bool hqdec, const AmbDecConf *conf, const ALuint (&speakermap)[MAX_OUTPUT_CHANNELS]) { - static constexpr ALuint chans_per_order2d[MAX_AMBI_ORDER+1] = { 1, 2, 2, 2 }; - static constexpr ALuint chans_per_order3d[MAX_AMBI_ORDER+1] = { 1, 3, 5, 7 }; + static const ALuint chans_per_order2d[MAX_AMBI_ORDER+1] = { 1, 2, 2, 2 }; + static const ALuint chans_per_order3d[MAX_AMBI_ORDER+1] = { 1, 3, 5, 7 }; if(!hqdec && conf->FreqBands != 1) ERR("Basic renderer uses the high-frequency matrix as single-band (xover_freq = %.0fhz)\n", @@ -522,7 +522,7 @@ void InitCustomPanning(ALCdevice *device, bool hqdec, const AmbDecConf *conf, void InitHrtfPanning(ALCdevice *device) { - static constexpr AngularPoint AmbiPoints[]{ + static const AngularPoint AmbiPoints[]{ { Deg2Rad( 0.000000f), Deg2Rad( 0.000000f) }, { Deg2Rad( 0.000000f), Deg2Rad( 180.000000f) }, { Deg2Rad( 0.000000f), Deg2Rad( -90.000000f) }, @@ -550,7 +550,7 @@ void InitHrtfPanning(ALCdevice *device) { Deg2Rad( 35.264390f), Deg2Rad( 135.000000f) }, { Deg2Rad(-35.264390f), Deg2Rad( 135.000000f) }, }; - static constexpr ALfloat AmbiMatrix[][MAX_AMBI_CHANNELS]{ + static const float AmbiMatrix[][MAX_AMBI_CHANNELS]{ { 3.84615387e-02f, 0.00000000e+00f, 0.00000000e+00f, 8.33950391e-02f, 0.00000000e+00f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, 8.60662966e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -7.49473409e-02f, 0.00000000e+00f, 9.67566016e-02f }, { 3.84615387e-02f, 0.00000000e+00f, 0.00000000e+00f, -8.33950391e-02f, 0.00000000e+00f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, 8.60662966e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 7.49473409e-02f, 0.00000000e+00f, -9.67566016e-02f }, { 3.84615387e-02f, 8.33950391e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, -8.60662966e-02f, -9.67566016e-02f, 0.00000000e+00f, -7.49473409e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f }, @@ -578,15 +578,15 @@ void InitHrtfPanning(ALCdevice *device) { 3.84615385e-02f, -3.33333332e-02f, 3.33333335e-02f, -3.33333332e-02f, 4.55645099e-02f, -4.55645100e-02f, 5.38752428e-10f, -4.55645100e-02f, 0.00000000e+00f, -2.95742381e-02f, 6.33865691e-02f, -2.29081068e-02f, -3.74087810e-02f, -2.29081068e-02f, 0.00000000e+00f, 2.95742381e-02f }, { 3.84615385e-02f, -3.33333332e-02f, -3.33333335e-02f, -3.33333332e-02f, 4.55645099e-02f, 4.55645100e-02f, 5.38752429e-10f, 4.55645100e-02f, 0.00000000e+00f, -2.95742381e-02f, -6.33865691e-02f, -2.29081068e-02f, 3.74087810e-02f, -2.29081068e-02f, 0.00000000e+00f, 2.95742381e-02f }, }; - static constexpr ALfloat AmbiOrderHFGain1O[MAX_AMBI_ORDER+1]{ + static const float AmbiOrderHFGain1O[MAX_AMBI_ORDER+1]{ 3.60555128e+00f, 2.08166600e+00f }, AmbiOrderHFGain2O[MAX_AMBI_ORDER+1]{ 2.68741925e+00f, 2.08166600e+00f, 1.07496770e+00f }, AmbiOrderHFGain3O[MAX_AMBI_ORDER+1]{ 2.12652604e+00f, 1.83122879e+00f, 1.30214339e+00f, 6.48052398e-01f }; - static constexpr ALuint ChansPerOrder[MAX_AMBI_ORDER+1]{ 1, 3, 5, 7 }; - const ALfloat *AmbiOrderHFGain{AmbiOrderHFGain1O}; + static const ALuint ChansPerOrder[MAX_AMBI_ORDER+1]{ 1, 3, 5, 7 }; + const float *AmbiOrderHFGain{AmbiOrderHFGain1O}; static_assert(al::size(AmbiPoints) == al::size(AmbiMatrix), "Ambisonic HRTF mismatch"); @@ -602,7 +602,7 @@ void InitHrtfPanning(ALCdevice *device) RenderMode mode; ALuint order; }; - static constexpr HrtfModeEntry hrtf_modes[]{ + static const HrtfModeEntry hrtf_modes[]{ { "full", HrtfRender, 1 }, { "ambi1", NormalRender, 1 }, { "ambi2", NormalRender, 2 }, @@ -662,7 +662,7 @@ void InitHrtfPanning(ALCdevice *device) void InitUhjPanning(ALCdevice *device) { /* UHJ is always 2D first-order. */ - static constexpr size_t count{Ambi2DChannelsFromOrder(1)}; + constexpr size_t count{Ambi2DChannelsFromOrder(1)}; device->mAmbiOrder = 1; |