diff options
author | Chris Robinson <[email protected]> | 2021-12-11 21:42:34 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2021-12-11 21:42:34 -0800 |
commit | 5e3fcb3a934844f1d70aa23a8a871a6915565ed2 (patch) | |
tree | 34957fb6f4f8da7b522f131f781844e21a4c8f33 /core/voice.cpp | |
parent | 01dd34f305b9ad2c8e6bf0642cd976f9788fdf3a (diff) |
Avoid initializing the NFC filter for every voice channel
It can be initialized once with the device's speaker distance since it won't
change in between resets, then copied into the voice where it can be adjusted
as needed.
Diffstat (limited to 'core/voice.cpp')
-rw-r--r-- | core/voice.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/core/voice.cpp b/core/voice.cpp index 923d7275..f7a5940a 100644 --- a/core/voice.cpp +++ b/core/voice.cpp @@ -852,6 +852,7 @@ void Voice::prepare(DeviceBase *device) chandata.mAmbiLFScale = 1.0f; chandata.mAmbiSplitter = splitter; chandata.mDryParams = DirectParams{}; + chandata.mDryParams.NFCtrlFilter = device->mNFCtrlFilter; std::fill_n(chandata.mWetParams.begin(), device->NumAuxSends, SendParams{}); } /* 2-channel UHJ needs different shelf filters. However, we can't just @@ -886,6 +887,7 @@ void Voice::prepare(DeviceBase *device) chandata.mAmbiLFScale = 1.0f; chandata.mAmbiSplitter = splitter; chandata.mDryParams = DirectParams{}; + chandata.mDryParams.NFCtrlFilter = device->mNFCtrlFilter; std::fill_n(chandata.mWetParams.begin(), device->NumAuxSends, SendParams{}); } mChans[0].mAmbiLFScale = 0.661f; @@ -898,16 +900,9 @@ void Voice::prepare(DeviceBase *device) for(auto &chandata : mChans) { chandata.mDryParams = DirectParams{}; + chandata.mDryParams.NFCtrlFilter = device->mNFCtrlFilter; std::fill_n(chandata.mWetParams.begin(), device->NumAuxSends, SendParams{}); } mFlags &= ~VoiceIsAmbisonic; } - - if(device->AvgSpeakerDist > 0.0f) - { - const float w1{SpeedOfSoundMetersPerSec / - (device->AvgSpeakerDist * static_cast<float>(device->Frequency))}; - for(auto &chandata : mChans) - chandata.mDryParams.NFCtrlFilter.init(w1); - } } |