aboutsummaryrefslogtreecommitdiffstats
path: root/alc/alc.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2021-03-30 07:04:06 -0700
committerChris Robinson <[email protected]>2021-03-30 07:04:06 -0700
commit051d6fb243c3d6843b5f5b24684cc9324cdc1de1 (patch)
treecf5e35643d8262515d4b077b9e9f7d09b3cccb90 /alc/alc.cpp
parent7b2f19449041317c575cca4da0b5fea74570f310 (diff)
Combine some duplicate code
Diffstat (limited to 'alc/alc.cpp')
-rw-r--r--alc/alc.cpp49
1 files changed, 1 insertions, 48 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp
index 2de0b47e..d5963d24 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -2218,54 +2218,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList)
if(voice->mSourceID.load(std::memory_order_relaxed) == 0u)
continue;
- voice->mStep = 0;
- voice->mFlags |= VoiceIsFading;
-
- /* Clear previous samples. */
- std::fill(voice->mVoiceSamples.begin(), voice->mVoiceSamples.end(),
- Voice::BufferLine{});
-
- if(voice->mAmbiOrder && device->mAmbiOrder > voice->mAmbiOrder)
- {
- const uint8_t *OrderFromChan{(voice->mFmtChannels == FmtBFormat2D) ?
- AmbiIndex::OrderFrom2DChannel().data() :
- AmbiIndex::OrderFromChannel().data()};
-
- const BandSplitter splitter{device->mXOverFreq /
- static_cast<float>(device->Frequency)};
-
- const auto scales = BFormatDec::GetHFOrderScales(voice->mAmbiOrder,
- device->mAmbiOrder);
- for(auto &chandata : voice->mChans)
- {
- chandata.mAmbiScale = scales[*(OrderFromChan++)];
- chandata.mAmbiSplitter = splitter;
- chandata.mDryParams = DirectParams{};
- std::fill_n(chandata.mWetParams.begin(), num_sends, SendParams{});
- }
-
- voice->mFlags |= VoiceIsAmbisonic;
- }
- else
- {
- /* Clear previous params. */
- for(auto &chandata : voice->mChans)
- {
- chandata.mDryParams = DirectParams{};
- std::fill_n(chandata.mWetParams.begin(), num_sends, SendParams{});
- }
-
- voice->mFlags &= ~VoiceIsAmbisonic;
- }
-
- if(device->AvgSpeakerDist > 0.0f)
- {
- /* Reinitialize the NFC filters for new parameters. */
- const float w1{SpeedOfSoundMetersPerSec /
- (device->AvgSpeakerDist * static_cast<float>(device->Frequency))};
- for(auto &chandata : voice->mChans)
- chandata.mDryParams.NFCtrlFilter.init(w1);
- }
+ voice->prepare(device);
}
srclock.unlock();