Fix setting the channel distance compensation buffers

This commit is contained in:
Chris Robinson 2021-05-20 23:41:17 -07:00
parent 0ec549ae7a
commit 8d868ff33f

View File

@ -284,9 +284,8 @@ void InitDistanceComp(ALCdevice *device, const AmbDecConf *conf,
if(total > 0)
{
auto chandelays = DistanceComp::Create(total);
std::copy(ChanDelay.cbegin(), ChanDelay.cend(), chandelays->mChannels.begin());
chandelays->mChannels[0].Buffer = chandelays->mSamples.data();
ChanDelay[0].Buffer = chandelays->mSamples.data();
auto set_bufptr = [](const DistanceComp::ChanData &last, const DistanceComp::ChanData &cur)
-> DistanceComp::ChanData
{
@ -294,7 +293,8 @@ void InitDistanceComp(ALCdevice *device, const AmbDecConf *conf,
ret.Buffer = last.Buffer + RoundUp(last.Length, 4);
return ret;
};
std::partial_sum(ChanDelay.begin(), ChanDelay.end(), ChanDelay.begin(), set_bufptr);
std::partial_sum(ChanDelay.begin(), ChanDelay.end(), chandelays->mChannels.begin(),
set_bufptr);
device->ChannelDelays = std::move(chandelays);
}
}