diff options
author | Chris Robinson <[email protected]> | 2021-03-19 19:02:30 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2021-03-19 23:15:27 -0700 |
commit | 063da94bd8f4e2dc0369c283a7fa0f124764eb1c (patch) | |
tree | 974a8935401c8a04ff8619069002ac05bfe91320 /alc/alc.cpp | |
parent | f7f29999601c7f4d0350fb43ceca8a5d84bc1432 (diff) |
Load/convert samples from all channels at once for mixing
This uses a bit more memory (each voice needs to hold buffers for the
deinterleaved samples of each channel, instead of just one buffer for the
current channel being mixed on the device), but it will allow for handling
formats that need or prefer their channels decoded together.
Diffstat (limited to 'alc/alc.cpp')
-rw-r--r-- | alc/alc.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 6c2f3f44..0cd20f62 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -2221,6 +2221,10 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) 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) ? @@ -2234,7 +2238,6 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) device->mAmbiOrder); for(auto &chandata : voice->mChans) { - chandata.mPrevSamples.fill(0.0f); chandata.mAmbiScale = scales[*(OrderFromChan++)]; chandata.mAmbiSplitter = splitter; chandata.mDryParams = DirectParams{}; @@ -2245,10 +2248,9 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) } else { - /* Clear previous samples. */ + /* Clear previous params. */ for(auto &chandata : voice->mChans) { - chandata.mPrevSamples.fill(0.0f); chandata.mDryParams = DirectParams{}; std::fill_n(chandata.mWetParams.begin(), num_sends, SendParams{}); } |