From: <sv...@op...> - 2024-06-27 18:35:48
|
Author: sagamusix Date: Thu Jun 27 20:35:40 2024 New Revision: 21090 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21090 Log: [Fix] FTM: Calculate song length correctly if a file changes the speed or tempo based on channel volume (see schlendering.ftm, https://www.un4seen.com/forum/?topic=15448.msg143168#msg143168). Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp Thu Jun 27 19:25:32 2024 (r21089) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp Thu Jun 27 20:35:40 2024 (r21090) @@ -809,8 +809,9 @@ break; } - // The following calculations are not interesting if we just want to get the song length. - if(!(adjustMode & eAdjust)) + // The following calculations are not interesting if we just want to get the song length... + // ...unless we're playing a Face The Music module with scripts that may modify the speed or tempo based on some volume or pitch variable (see schlendering.ftm) + if(!(adjustMode & eAdjust) && m_globalScript.empty()) continue; ResetAutoSlides(chn); @@ -1049,6 +1050,14 @@ } } + if(!m_globalScript.empty()) + { + for(uint32 i = 0; i < nonRowTicks; i++) + { + playState.m_globalScriptState.NextTick(playState, *this); + } + } + // Interpret F00 effect in XM files as "stop song" if(GetType() == MOD_TYPE_XM && playState.m_nMusicSpeed == uint16_max) { |