diff options
author | Chris Robinson <[email protected]> | 2022-05-16 22:49:03 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-05-16 22:49:03 -0700 |
commit | 3e9597a76829717ff5c6dac718bce7a0f072ba4a (patch) | |
tree | f624da9482f7208531e4e25895d6d739e953c6cd /core | |
parent | 65e4c20c27f2acf853e58fd4c26ebc0e3eb926c6 (diff) |
Avoid magic numbers
Diffstat (limited to 'core')
-rw-r--r-- | core/uhjfilter.h | 4 | ||||
-rw-r--r-- | core/voice.cpp | 12 |
2 files changed, 10 insertions, 6 deletions
diff --git a/core/uhjfilter.h b/core/uhjfilter.h index 73be7d17..ab967948 100644 --- a/core/uhjfilter.h +++ b/core/uhjfilter.h @@ -49,6 +49,10 @@ struct UhjEncoder : public UhjFilterBase { struct UhjDecoder : public DecoderBase, public UhjFilterBase { + /* For 2-channel UHJ, shelf filters should use these LF responses. */ + static constexpr float sWLFScale{0.661f}; + static constexpr float sXYLFScale{1.293f}; + alignas(16) std::array<float,BufferLineSize+MaxResamplerEdge+sFilterDelay> mS{}; alignas(16) std::array<float,BufferLineSize+MaxResamplerEdge+sFilterDelay> mD{}; alignas(16) std::array<float,BufferLineSize+MaxResamplerEdge+sFilterDelay> mT{}; diff --git a/core/voice.cpp b/core/voice.cpp index 48a2de51..8e42500e 100644 --- a/core/voice.cpp +++ b/core/voice.cpp @@ -900,9 +900,9 @@ void Voice::prepare(DeviceBase *device) */ if(mFmtChannels == FmtUHJ2) { - mChans[0].mAmbiLFScale = 0.661f; - mChans[1].mAmbiLFScale = 1.293f; - mChans[2].mAmbiLFScale = 1.293f; + mChans[0].mAmbiLFScale = UhjDecoder::sWLFScale; + mChans[1].mAmbiLFScale = UhjDecoder::sXYLFScale; + mChans[2].mAmbiLFScale = UhjDecoder::sXYLFScale; } mFlags.set(VoiceIsAmbisonic); } @@ -922,9 +922,9 @@ void Voice::prepare(DeviceBase *device) chandata.mDryParams.NFCtrlFilter = device->mNFCtrlFilter; std::fill_n(chandata.mWetParams.begin(), device->NumAuxSends, SendParams{}); } - mChans[0].mAmbiLFScale = 0.661f; - mChans[1].mAmbiLFScale = 1.293f; - mChans[2].mAmbiLFScale = 1.293f; + mChans[0].mAmbiLFScale = UhjDecoder::sWLFScale; + mChans[1].mAmbiLFScale = UhjDecoder::sXYLFScale; + mChans[2].mAmbiLFScale = UhjDecoder::sXYLFScale; mFlags.set(VoiceIsAmbisonic); } else |