Author: sagamusix
Date: Sat Jun 8 14:24:39 2024
New Revision: 20955
URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20955
Log:
[Fix] S3M: Don't write to ChnSettings past the last channel.
Modified:
trunk/OpenMPT/soundlib/Load_s3m.cpp
Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp
==============================================================================
--- trunk/OpenMPT/soundlib/Load_s3m.cpp Sat Jun 8 14:21:22 2024 (r20954)
+++ trunk/OpenMPT/soundlib/Load_s3m.cpp Sat Jun 8 14:24:39 2024 (r20955)
@@ -487,15 +487,12 @@
{
bool hasChannelsWithoutPanning = false;
const auto pan = file.ReadArray<uint8, 32>();
- for(CHANNELINDEX i = 0; i < 32; i++)
+ for(CHANNELINDEX i = 0; i < GetNumChannels(); i++)
{
if((pan[i] & 0x20) != 0 && (!isST3 || !isAdlibChannel[i]))
- {
ChnSettings[i].nPan = static_cast<uint16>((static_cast<uint16>(pan[i] & 0x0F) * 256 + 8) / 15u);
- } else if(pan[i] < 0x10)
- {
+ else if(pan[i] < 0x10)
hasChannelsWithoutPanning = true;
- }
}
if(GetNumChannels() < 32 && m_dwLastSavedWithVersion == MPT_V("1.16"))
{
|