From: <sv...@op...> - 2024-07-26 18:07:47
|
Author: sagamusix Date: Fri Jul 26 20:07:35 2024 New Revision: 21296 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21296 Log: Merged revision(s) 21286 from trunk/OpenMPT: [Fix] Fix inconsistency in length calculation and actual playback length in libopenmpt with tempo commands below 32 BPM in various formats (MDL, MED among others). ........ Modified: branches/OpenMPT-1.28/ (props changed) branches/OpenMPT-1.28/soundlib/Snd_fx.cpp Modified: branches/OpenMPT-1.28/soundlib/Snd_fx.cpp ============================================================================== --- branches/OpenMPT-1.28/soundlib/Snd_fx.cpp Fri Jul 26 20:06:04 2024 (r21295) +++ branches/OpenMPT-1.28/soundlib/Snd_fx.cpp Fri Jul 26 20:07:35 2024 (r21296) @@ -44,6 +44,12 @@ static uint32 GetFineLinearSlideDownTable(const CSoundFile *sndFile, uint32 i) { MPT_ASSERT(i < CountOf(FineLinearSlideDownTable)); return sndFile->m_playBehaviour[kHertzInLinearMode] ? FineLinearSlideDownTable[i] : FineLinearSlideUpTable[i]; } static uint32 GetFineLinearSlideUpTable (const CSoundFile *sndFile, uint32 i) { MPT_ASSERT(i < CountOf(FineLinearSlideDownTable)); return sndFile->m_playBehaviour[kHertzInLinearMode] ? FineLinearSlideUpTable[i] : FineLinearSlideDownTable[i]; } +// Minimum parameter of tempo command that is considered to be a BPM rather than a tempo slide +static constexpr TEMPO GetMinimumTempoParam(MODTYPE modType) +{ + return (modType & (MOD_TYPE_MDL | MOD_TYPE_MED | MOD_TYPE_XM | MOD_TYPE_MOD)) ? TEMPO(1, 0) : TEMPO(32, 0); +} + //////////////////////////////////////////////////////////// // Length @@ -639,7 +645,7 @@ } const auto &specs = GetModSpecifications(); - if(tempo.GetInt() >= 0x20) + if(tempo >= GetMinimumTempoParam(GetType())) { #if MPT_MSVC_BEFORE(2019, 0) // Work-around for VS2017 /std:c++17 /permissive- @@ -5727,7 +5733,7 @@ const CModSpecifications &specs = GetModSpecifications(); // Anything lower than the minimum tempo is considered to be a tempo slide - const TEMPO minTempo = (GetType() == MOD_TYPE_MDL) ? TEMPO(1, 0) : TEMPO(32, 0); + const TEMPO minTempo = GetMinimumTempoParam(GetType()); if(setFromUI) { |