From: <sag...@us...> - 2013-06-17 22:46:13
|
Revision: 2391 http://sourceforge.net/p/modplug/code/2391 Author: saga-games Date: 2013-06-17 22:46:04 +0000 (Mon, 17 Jun 2013) Log Message: ----------- [Fix] Song Length Estimation: More pattern loop fixes, and tempo slides shouldn't underflow anymore. [Mod] OpenMPT: Version is now 1.22.03.05 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2013-06-17 21:20:40 UTC (rev 2390) +++ trunk/OpenMPT/common/versionNumber.h 2013-06-17 22:46:04 UTC (rev 2391) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 03 -#define VER_MINORMINOR 04 +#define VER_MINORMINOR 05 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR)"."VER_STRINGIZE(VER_MAJOR)"."VER_STRINGIZE(VER_MINOR)"."VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-06-17 21:20:40 UTC (rev 2390) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-06-17 22:46:04 UTC (rev 2391) @@ -342,13 +342,19 @@ if (param) pChn->nOldTempo = (BYTE)param; else param = pChn->nOldTempo; } if (param >= 0x20) memory.musicTempo = param; else - // Tempo Slide - if ((param & 0xF0) == 0x10) { - memory.musicTempo += (param & 0x0F) * (memory.musicSpeed - 1); //rewbs.tempoSlideFix - } else - { - memory.musicTempo -= (param & 0x0F) * (memory.musicSpeed - 1); //rewbs.tempoSlideFix + // Tempo Slide + uint32 tempoDiff = (param & 0x0F) * (memory.musicSpeed - 1); + if ((param & 0xF0) == 0x10) + { + memory.musicTempo += tempoDiff; + } else + { + if(tempoDiff < memory.musicTempo) + memory.musicTempo -= tempoDiff; + else + memory.musicTempo = 32; + } } // -> CODE#0010 // -> DESC="add extended parameter mechanism to pattern effects" @@ -382,12 +388,21 @@ // Pattern Loop if (param & 0x0F) { - memory.elapsedTime += (memory.elapsedTime - memory.chnSettings[nChn].patLoop) * (double)(param & 0x0F); patternLoopEndedOnThisRow = true; } else { - memory.chnSettings[nChn].patLoop = memory.elapsedTime; - memory.chnSettings[nChn].patLoopStart = nRow; + CHANNELINDEX firstChn = nChn, lastChn = nChn; + if(GetType() == MOD_TYPE_S3M) + { + // ST3 has only one global loop memory. + firstChn = 0; + lastChn = GetNumChannels() - 1; + } + for(CHANNELINDEX c = firstChn; c < lastChn; c++) + { + memory.chnSettings[c].patLoop = memory.elapsedTime; + memory.chnSettings[c].patLoopStart = nRow; + } } } break; @@ -402,8 +417,8 @@ // Pattern Loop if (param & 0x0F) { - memory.elapsedTime += (memory.elapsedTime - memory.chnSettings[nChn].patLoop) * (double)(param & 0x0F); nNextPatStartRow = memory.chnSettings[nChn].patLoopStart; // FT2 E60 bug + patternLoopEndedOnThisRow = true; } else { memory.chnSettings[nChn].patLoop = memory.elapsedTime; @@ -534,23 +549,34 @@ rowsPerBeat = Patterns[nPattern].GetRowsPerBeat(); } - const UINT tickDuration = GetTickDuration(memory.musicTempo, memory.musicSpeed, rowsPerBeat); - const UINT rowDuration = tickDuration * (memory.musicSpeed + tickDelay) * MAX(rowDelay, 1); - const double rowDurationDbl = static_cast<double>(rowDuration) / static_cast<double>(m_MixerSettings.gdwMixingFreq); - memory.elapsedTime += rowDurationDbl; + const uint32 tickDuration = GetTickDuration(memory.musicTempo, memory.musicSpeed, rowsPerBeat); + const uint32 rowDuration = tickDuration * (memory.musicSpeed + tickDelay) * MAX(rowDelay, 1); + memory.elapsedTime += static_cast<double>(rowDuration) / static_cast<double>(m_MixerSettings.gdwMixingFreq); memory.renderedSamples += rowDuration; - if(GetType() == MOD_TYPE_IT && patternLoopEndedOnThisRow) + if(patternLoopEndedOnThisRow) { - // IT pattern loop start row update - at the end of a pattern loop, set pattern loop start to next row (for upcoming pattern loops with missing SB0) p = Patterns[nPattern].GetRow(nRow); - for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); p++, pChn++, nChn++) + for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); p++, nChn++) { - if(p->command == CMD_S3MCMDEX && p->param >= 0xB1 && p->param <= 0xBF) + if((p->command == CMD_S3MCMDEX && p->param >= 0xB1 && p->param <= 0xBF) + || (p->command == CMD_MODCMDEX && p->param >= 0x61 && p->param <= 0x6F)) { - memory.chnSettings[nChn].patLoop = memory.elapsedTime; + memory.elapsedTime += (memory.elapsedTime - memory.chnSettings[nChn].patLoop) * (double)(p->param & 0x0F); } } + if(GetType() == MOD_TYPE_IT) + { + // IT pattern loop start row update - at the end of a pattern loop, set pattern loop start to next row (for upcoming pattern loops with missing SB0) + p = Patterns[nPattern].GetRow(nRow); + for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); p++, nChn++) + { + if((p->command == CMD_S3MCMDEX && p->param >= 0xB1 && p->param <= 0xBF)) + { + memory.chnSettings[nChn].patLoop = memory.elapsedTime; + } + } + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |