aboutsummaryrefslogtreecommitdiffstats
path: root/al/source.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 /al/source.cpp
parent7b2f19449041317c575cca4da0b5fea74570f310 (diff)
Combine some duplicate code
Diffstat (limited to 'al/source.cpp')
-rw-r--r--al/source.cpp43
1 files changed, 1 insertions, 42 deletions
diff --git a/al/source.cpp b/al/source.cpp
index 5b95e9ed..b2bb0d75 100644
--- a/al/source.cpp
+++ b/al/source.cpp
@@ -452,11 +452,6 @@ void InitVoice(Voice *voice, ALsource *source, ALbufferQueueItem *BufferList, AL
else if(source->SourceType == AL_STATIC) voice->mFlags |= VoiceIsStatic;
voice->mNumCallbackSamples = 0;
- /* Clear the stepping value explicitly so the mixer knows not to mix this
- * until the update gets applied.
- */
- voice->mStep = 0;
-
if(voice->mChans.capacity() > 2 && num_channels < voice->mChans.capacity())
{
decltype(voice->mChans){}.swap(voice->mChans);
@@ -466,44 +461,8 @@ void InitVoice(Voice *voice, ALsource *source, ALbufferQueueItem *BufferList, AL
voice->mChans.resize(num_channels);
voice->mVoiceSamples.reserve(maxu(2, num_channels));
voice->mVoiceSamples.resize(num_channels);
- std::fill_n(voice->mVoiceSamples.begin(), num_channels, Voice::BufferLine{});
-
- /* Don't need to set the VOICE_IS_AMBISONIC flag if the device is not
- * higher order than the voice. No HF scaling is necessary to mix it.
- */
- if(voice->mAmbiOrder && device->mAmbiOrder > voice->mAmbiOrder)
- {
- const uint8_t *OrderFromChan{(voice->mFmtChannels == FmtBFormat2D) ?
- AmbiIndex::OrderFrom2DChannel().data() : AmbiIndex::OrderFromChannel().data()};
- const auto scales = BFormatDec::GetHFOrderScales(voice->mAmbiOrder, device->mAmbiOrder);
- const BandSplitter splitter{device->mXOverFreq / static_cast<float>(device->Frequency)};
- for(auto &chandata : voice->mChans)
- {
- chandata.mAmbiScale = scales[*(OrderFromChan++)];
- chandata.mAmbiSplitter = splitter;
- chandata.mDryParams = DirectParams{};
- std::fill_n(chandata.mWetParams.begin(), device->NumAuxSends, SendParams{});
- }
-
- voice->mFlags |= VoiceIsAmbisonic;
- }
- else
- {
- for(auto &chandata : voice->mChans)
- {
- chandata.mDryParams = DirectParams{};
- std::fill_n(chandata.mWetParams.begin(), device->NumAuxSends, SendParams{});
- }
- }
-
- if(device->AvgSpeakerDist > 0.0f)
- {
- const float w1{SpeedOfSoundMetersPerSec /
- (device->AvgSpeakerDist * static_cast<float>(device->Frequency))};
- for(auto &chandata : voice->mChans)
- chandata.mDryParams.NFCtrlFilter.init(w1);
- }
+ voice->prepare(device);
source->PropsClean.test_and_set(std::memory_order_acq_rel);
UpdateSourceProps(source, voice, context);