From: <sv...@op...> - 2024-09-22 22:37:09
|
Author: sagamusix Date: Mon Sep 23 00:36:58 2024 New Revision: 21686 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21686 Log: [Fix] PTM: Polytracker is another one of those trackers where offset command strength is halved by using 16-bit samples... fixes leveled.ptm (https://www.un4seen.com/forum/?topic=15448.msg143764#msg143764). Modified: trunk/OpenMPT/soundlib/Load_ptm.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Load_ptm.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_ptm.cpp Mon Sep 23 00:12:23 2024 (r21685) +++ trunk/OpenMPT/soundlib/Load_ptm.cpp Mon Sep 23 00:36:58 2024 (r21686) @@ -271,6 +271,13 @@ case CMD_GLOBALVOLUME: m.param = std::min(m.param, uint8(0x40)) * 2u; break; +#ifdef MODPLUG_TRACKER + case CMD_OFFSET: + case CMD_REVERSEOFFSET: + if(m.instr && m.instr <= GetNumSamples() && Samples[m.instr].uFlags[CHN_16BIT]) + m.param /= 2; + break; +#endif // MODPLUG_TRACKER default: break; } Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp Mon Sep 23 00:12:23 2024 (r21685) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp Mon Sep 23 00:36:58 2024 (r21686) @@ -5805,9 +5805,9 @@ param = (param - chn.nLoopStart) % (chn.nLoopEnd - chn.nLoopStart) + chn.nLoopStart; } - if(GetType() == MOD_TYPE_MDL && chn.dwFlags[CHN_16BIT]) + if((GetType() & (MOD_TYPE_MDL | MOD_TYPE_PTM)) && chn.dwFlags[CHN_16BIT]) { - // Digitrakker really uses byte offsets, not sample offsets. WTF! + // Digitrakker and Polytracker use byte offsets, not sample offsets. param /= 2u; } @@ -5883,7 +5883,10 @@ chn.dwFlags.set(CHN_PINGPONGFLAG); chn.dwFlags.reset(CHN_LOOP); chn.nLength = chn.pModSample->nLength; // If there was a loop, extend sample to whole length. - chn.position.Set((chn.nLength - 1) - std::min(SmpLength(param) << 8, chn.nLength - SmpLength(1)), 0); + SmpLength offset = param << 8; + if(GetType() == MOD_TYPE_PTM && chn.dwFlags[CHN_16BIT]) + offset /= 2; + chn.position.Set((chn.nLength - 1) - std::min(offset, chn.nLength - SmpLength(1)), 0); } } |