Browse Source

Fix copy on bit depth mismatch

Miku AuahDark 4 years ago
parent
commit
e8ddcdceb2
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/modules/sound/SoundData.cpp

+ 1 - 1
src/modules/sound/SoundData.cpp

@@ -276,7 +276,7 @@ void SoundData::copyFrom(const SoundData *src, int srcStart, int count, int dstS
 	{
 	{
 		// Bit depth mismatch, use get/setSample at loop
 		// Bit depth mismatch, use get/setSample at loop
 		for (int i = 0; i < count * channels; i++)
 		for (int i = 0; i < count * channels; i++)
-			setSample(dstStart + i, src->getSample(srcStart + i));
+			setSample(dstStart * channels + i, src->getSample(srcStart * channels + i));
 	}
 	}
 	else if (this->data == src->data)
 	else if (this->data == src->data)
 		// May overlap, use memmove
 		// May overlap, use memmove