Fix issue with mono -> stereo upsampling

This commit is contained in:
rexy712 2020-08-22 02:19:14 -07:00
parent 9d2c64eb68
commit a71c3c27c4

View File

@ -158,9 +158,9 @@ namespace audio::impl{
//copy data into the output buffer
size_t real_floatcount = real_framecount * out_channels;
size_t offset_float = offset * data.channels;
for(size_t j = 0;j < real_floatcount;j += out_channels){
for(size_t k = 0;k < out_channels;++k){
foutput[j+k] += ((data.data + offset_float)[j + (k % data.channels)] * data.volume);
for(size_t j = 0, k = 0;j < real_floatcount;j += out_channels, k += data.channels){
for(size_t l = 0;l < out_channels;++l){
foutput[j+l] += ((data.data + offset_float)[k + (l % data.channels)] * data.volume);
}
}