diff options
author | Chris Robinson <[email protected]> | 2023-01-16 21:45:03 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-01-16 21:45:03 -0800 |
commit | 3d00147b99d4996f322ff231a7e0e7d9aff86f60 (patch) | |
tree | aa6dde806a0d279fad83d77dbbf4f5f8356c6ce4 /alc | |
parent | 8e9833c7a6dfe53b570d5a021888f2a5397b4796 (diff) |
Change a couple macros to constexpr variables
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alc.cpp | 2 | ||||
-rw-r--r-- | alc/alu.cpp | 8 | ||||
-rw-r--r-- | alc/backends/base.cpp | 4 | ||||
-rw-r--r-- | alc/effects/autowah.cpp | 6 | ||||
-rw-r--r-- | alc/effects/compressor.cpp | 4 | ||||
-rw-r--r-- | alc/effects/dedicated.cpp | 8 | ||||
-rw-r--r-- | alc/effects/equalizer.cpp | 6 | ||||
-rw-r--r-- | alc/effects/modulator.cpp | 6 | ||||
-rw-r--r-- | alc/effects/vmorpher.cpp | 6 | ||||
-rw-r--r-- | alc/panning.cpp | 16 |
10 files changed, 33 insertions, 33 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index bf428e07..3d807284 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -2003,7 +2003,7 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) device->Dry.Buffer = {}; std::fill(std::begin(device->NumChannelsPerOrder), std::end(device->NumChannelsPerOrder), 0u); device->RealOut.RemixMap = {}; - device->RealOut.ChannelIndex.fill(INVALID_CHANNEL_INDEX); + device->RealOut.ChannelIndex.fill(InvalidChannelIndex); device->RealOut.Buffer = {}; device->MixBuffer.clear(); device->MixBuffer.shrink_to_fit(); diff --git a/alc/alu.cpp b/alc/alu.cpp index 207c7c84..7b844c58 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -993,7 +993,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con for(size_t c{0};c < num_channels;c++) { uint idx{Device->channelIdxByName(chans[c].channel)}; - if(idx != INVALID_CHANNEL_INDEX) + if(idx != InvalidChannelIndex) voice->mChans[c].mDryParams.Gains.Target[idx] = DryGain.Base; else if(DirectChannels == DirectMode::RemixMismatch) { @@ -1006,7 +1006,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con for(const auto &target : remap->targets) { idx = Device->channelIdxByName(target.channel); - if(idx != INVALID_CHANNEL_INDEX) + if(idx != InvalidChannelIndex) voice->mChans[c].mDryParams.Gains.Target[idx] = DryGain.Base * target.mix; } @@ -1197,7 +1197,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con if(Device->Dry.Buffer.data() == Device->RealOut.Buffer.data()) { const uint idx{Device->channelIdxByName(chans[c].channel)}; - if(idx != INVALID_CHANNEL_INDEX) + if(idx != InvalidChannelIndex) voice->mChans[c].mDryParams.Gains.Target[idx] = DryGain.Base; } continue; @@ -1263,7 +1263,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con if(Device->Dry.Buffer.data() == Device->RealOut.Buffer.data()) { const uint idx{Device->channelIdxByName(chans[c].channel)}; - if(idx != INVALID_CHANNEL_INDEX) + if(idx != InvalidChannelIndex) voice->mChans[c].mDryParams.Gains.Target[idx] = DryGain.Base; } continue; diff --git a/alc/backends/base.cpp b/alc/backends/base.cpp index 9cf5e30f..e5ad8494 100644 --- a/alc/backends/base.cpp +++ b/alc/backends/base.cpp @@ -68,7 +68,7 @@ ClockLatency BackendBase::getClockLatency() void BackendBase::setDefaultWFXChannelOrder() { - mDevice->RealOut.ChannelIndex.fill(INVALID_CHANNEL_INDEX); + mDevice->RealOut.ChannelIndex.fill(InvalidChannelIndex); switch(mDevice->FmtChans) { @@ -143,7 +143,7 @@ void BackendBase::setDefaultWFXChannelOrder() void BackendBase::setDefaultChannelOrder() { - mDevice->RealOut.ChannelIndex.fill(INVALID_CHANNEL_INDEX); + mDevice->RealOut.ChannelIndex.fill(InvalidChannelIndex); switch(mDevice->FmtChans) { diff --git a/alc/effects/autowah.cpp b/alc/effects/autowah.cpp index 50ec0268..f32c69b8 100644 --- a/alc/effects/autowah.cpp +++ b/alc/effects/autowah.cpp @@ -65,7 +65,7 @@ struct AutowahState final : public EffectState { } mEnv[BufferLineSize]; struct { - uint mTargetChannel{INVALID_CHANNEL_INDEX}; + uint mTargetChannel{InvalidChannelIndex}; /* Effect filters' history. */ struct { @@ -110,7 +110,7 @@ void AutowahState::deviceUpdate(const DeviceBase*, const Buffer&) for(auto &chan : mChans) { - chan.mTargetChannel = INVALID_CHANNEL_INDEX; + chan.mTargetChannel = InvalidChannelIndex; chan.mFilter.z1 = 0.0f; chan.mFilter.z2 = 0.0f; chan.mCurrentGain = 0.0f; @@ -175,7 +175,7 @@ void AutowahState::process(const size_t samplesToDo, for(const auto &insamples : samplesIn) { const size_t outidx{chandata->mTargetChannel}; - if(outidx == INVALID_CHANNEL_INDEX) + if(outidx == InvalidChannelIndex) { ++chandata; continue; diff --git a/alc/effects/compressor.cpp b/alc/effects/compressor.cpp index c57bd58c..299394cf 100644 --- a/alc/effects/compressor.cpp +++ b/alc/effects/compressor.cpp @@ -65,7 +65,7 @@ namespace { struct CompressorState final : public EffectState { /* Effect gains for each channel */ struct { - uint mTarget{INVALID_CHANNEL_INDEX}; + uint mTarget{InvalidChannelIndex}; float mGain{1.0f}; } mChans[MaxAmbiChannels]; @@ -168,7 +168,7 @@ void CompressorState::process(const size_t samplesToDo, for(const auto &input : samplesIn) { const size_t outidx{chan->mTarget}; - if(outidx != INVALID_CHANNEL_INDEX) + if(outidx != InvalidChannelIndex) { const float *RESTRICT src{input.data() + base}; float *RESTRICT dst{samplesOut[outidx].data() + base}; diff --git a/alc/effects/dedicated.cpp b/alc/effects/dedicated.cpp index a1c85ecd..e666df9f 100644 --- a/alc/effects/dedicated.cpp +++ b/alc/effects/dedicated.cpp @@ -74,8 +74,8 @@ void DedicatedState::update(const ContextBase*, const EffectSlot *slot, if(slot->EffectType == EffectSlotType::DedicatedLFE) { - const uint idx{target.RealOut ? target.RealOut->ChannelIndex[LFE] : INVALID_CHANNEL_INDEX}; - if(idx != INVALID_CHANNEL_INDEX) + const uint idx{target.RealOut ? target.RealOut->ChannelIndex[LFE] : InvalidChannelIndex}; + if(idx != InvalidChannelIndex) { mOutTarget = target.RealOut->Buffer; mTargetGains[idx] = Gain; @@ -86,8 +86,8 @@ void DedicatedState::update(const ContextBase*, const EffectSlot *slot, /* Dialog goes to the front-center speaker if it exists, otherwise it * plays from the front-center location. */ const uint idx{target.RealOut ? target.RealOut->ChannelIndex[FrontCenter] - : INVALID_CHANNEL_INDEX}; - if(idx != INVALID_CHANNEL_INDEX) + : InvalidChannelIndex}; + if(idx != InvalidChannelIndex) { mOutTarget = target.RealOut->Buffer; mTargetGains[idx] = Gain; diff --git a/alc/effects/equalizer.cpp b/alc/effects/equalizer.cpp index f7e2a071..9d7cccef 100644 --- a/alc/effects/equalizer.cpp +++ b/alc/effects/equalizer.cpp @@ -87,7 +87,7 @@ namespace { struct EqualizerState final : public EffectState { struct { - uint mTargetChannel{INVALID_CHANNEL_INDEX}; + uint mTargetChannel{InvalidChannelIndex}; /* Effect parameters */ BiquadFilter mFilter[4]; @@ -113,7 +113,7 @@ void EqualizerState::deviceUpdate(const DeviceBase*, const Buffer&) { for(auto &e : mChans) { - e.mTargetChannel = INVALID_CHANNEL_INDEX; + e.mTargetChannel = InvalidChannelIndex; std::for_each(std::begin(e.mFilter), std::end(e.mFilter), std::mem_fn(&BiquadFilter::clear)); e.mCurrentGain = 0.0f; @@ -176,7 +176,7 @@ void EqualizerState::process(const size_t samplesToDo, const al::span<const Floa for(const auto &input : samplesIn) { const size_t outidx{chan->mTargetChannel}; - if(outidx != INVALID_CHANNEL_INDEX) + if(outidx != InvalidChannelIndex) { const al::span<const float> inbuf{input.data(), samplesToDo}; DualBiquad{chan->mFilter[0], chan->mFilter[1]}.process(inbuf, buffer.begin()); diff --git a/alc/effects/modulator.cpp b/alc/effects/modulator.cpp index aa0b1f70..79993c0d 100644 --- a/alc/effects/modulator.cpp +++ b/alc/effects/modulator.cpp @@ -84,7 +84,7 @@ struct ModulatorState final : public EffectState { uint mStep{1}; struct { - uint mTargetChannel{INVALID_CHANNEL_INDEX}; + uint mTargetChannel{InvalidChannelIndex}; BiquadFilter mFilter; @@ -106,7 +106,7 @@ void ModulatorState::deviceUpdate(const DeviceBase*, const Buffer&) { for(auto &e : mChans) { - e.mTargetChannel = INVALID_CHANNEL_INDEX; + e.mTargetChannel = InvalidChannelIndex; e.mFilter.clear(); e.mCurrentGain = 0.0f; } @@ -160,7 +160,7 @@ void ModulatorState::process(const size_t samplesToDo, const al::span<const Floa for(const auto &input : samplesIn) { const size_t outidx{chandata->mTargetChannel}; - if(outidx != INVALID_CHANNEL_INDEX) + if(outidx != InvalidChannelIndex) { alignas(16) float temps[MAX_UPDATE_SAMPLES]; diff --git a/alc/effects/vmorpher.cpp b/alc/effects/vmorpher.cpp index 0eb136f9..97267ad9 100644 --- a/alc/effects/vmorpher.cpp +++ b/alc/effects/vmorpher.cpp @@ -143,7 +143,7 @@ struct FormantFilter struct VmorpherState final : public EffectState { struct { - uint mTargetChannel{INVALID_CHANNEL_INDEX}; + uint mTargetChannel{InvalidChannelIndex}; /* Effect parameters */ FormantFilter mFormants[NUM_FILTERS][NUM_FORMANTS]; @@ -231,7 +231,7 @@ void VmorpherState::deviceUpdate(const DeviceBase*, const Buffer&) { for(auto &e : mChans) { - e.mTargetChannel = INVALID_CHANNEL_INDEX; + e.mTargetChannel = InvalidChannelIndex; std::for_each(std::begin(e.mFormants[VOWEL_A_INDEX]), std::end(e.mFormants[VOWEL_A_INDEX]), std::mem_fn(&FormantFilter::clear)); std::for_each(std::begin(e.mFormants[VOWEL_B_INDEX]), std::end(e.mFormants[VOWEL_B_INDEX]), @@ -298,7 +298,7 @@ void VmorpherState::process(const size_t samplesToDo, const al::span<const Float for(const auto &input : samplesIn) { const size_t outidx{chandata->mTargetChannel}; - if(outidx == INVALID_CHANNEL_INDEX) + if(outidx == InvalidChannelIndex) { ++chandata; continue; diff --git a/alc/panning.cpp b/alc/panning.cpp index 62d745f1..d118f99c 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -263,7 +263,7 @@ void InitDistanceComp(ALCdevice *device, const al::span<const Channel> channels, { const Channel ch{channels[chidx]}; const uint idx{device->RealOut.ChannelIndex[ch]}; - if(idx == INVALID_CHANNEL_INDEX) + if(idx == InvalidChannelIndex) continue; const float distance{dists[chidx]}; @@ -275,11 +275,11 @@ void InitDistanceComp(ALCdevice *device, const al::span<const Channel> channels, * will be in steps of about 7 millimeters. */ float delay{std::floor((maxdist - distance)*distSampleScale + 0.5f)}; - if(delay > float{MAX_DELAY_LENGTH-1}) + if(delay > float{DistanceComp::MaxDelay-1}) { ERR("Delay for channel %u (%s) exceeds buffer length (%f > %d)\n", idx, - GetLabelFromChannel(ch), delay, MAX_DELAY_LENGTH-1); - delay = float{MAX_DELAY_LENGTH-1}; + GetLabelFromChannel(ch), delay, DistanceComp::MaxDelay-1); + delay = float{DistanceComp::MaxDelay-1}; } ChanDelay.resize(maxz(ChanDelay.size(), idx+1)); @@ -632,7 +632,7 @@ void InitPanning(ALCdevice *device, const bool hqdec=false, const bool stablize= for(size_t i{0u};i < decoder.mChannels.size();++i) { const uint idx{device->channelIdxByName(decoder.mChannels[i])}; - if(idx == INVALID_CHANNEL_INDEX) + if(idx == InvalidChannelIndex) { ERR("Failed to find %s channel in device\n", GetLabelFromChannel(decoder.mChannels[i])); @@ -1004,9 +1004,9 @@ void aluInitRenderer(ALCdevice *device, int hrtf_id, al::optional<StereoEncoding /* Enable the stablizer only for formats that have front-left, front- * right, and front-center outputs. */ - const bool stablize{device->RealOut.ChannelIndex[FrontCenter] != INVALID_CHANNEL_INDEX - && device->RealOut.ChannelIndex[FrontLeft] != INVALID_CHANNEL_INDEX - && device->RealOut.ChannelIndex[FrontRight] != INVALID_CHANNEL_INDEX + const bool stablize{device->RealOut.ChannelIndex[FrontCenter] != InvalidChannelIndex + && device->RealOut.ChannelIndex[FrontLeft] != InvalidChannelIndex + && device->RealOut.ChannelIndex[FrontRight] != InvalidChannelIndex && device->getConfigValueBool(nullptr, "front-stablizer", false) != 0}; const bool hqdec{device->getConfigValueBool("decoder", "hq-mode", true) != 0}; InitPanning(device, hqdec, stablize, decoder); |