From: <sag...@us...> - 2015-04-11 13:44:38
|
Revision: 4924 http://sourceforge.net/p/modplug/code/4924 Author: saga-games Date: 2015-04-11 13:44:32 +0000 (Sat, 11 Apr 2015) Log Message: ----------- [New] MOD: In PT1/2 mode, implement ProTracker oneshot loops: If the loop start is right at the start of the sample, play through the whole sample once and then repeat just the loop part. [Mod] OpenMPT: Version is now 1.24.02.10 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2015-04-11 12:53:11 UTC (rev 4923) +++ trunk/OpenMPT/common/versionNumber.h 2015-04-11 13:44:32 UTC (rev 4924) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 24 #define VER_MINOR 02 -#define VER_MINORMINOR 09 +#define VER_MINORMINOR 10 //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/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2015-04-11 12:53:11 UTC (rev 4923) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2015-04-11 13:44:32 UTC (rev 4924) @@ -481,22 +481,31 @@ } } - // ProTracker compatibility: Instrument changes without a note do not happen instantly, but rather when the sample loop has finished playing. - // Test case: PTInstrSwap.mod - if(m_SongFlags[SONG_PT1XMODE] && chn.nPos >= chn.nLoopEnd && chn.dwFlags[CHN_LOOP] && chn.nNewIns && chn.nNewIns <= GetNumSamples() && chn.pModSample != &Samples[chn.nNewIns]) + if(m_SongFlags[SONG_PT1XMODE] && chn.nPos >= chn.nLoopEnd && chn.dwFlags[CHN_LOOP]) { - const ModSample &smp = Samples[chn.nNewIns]; - chn.pModSample = &smp; - chn.pCurrentSample = smp.pSample; - chn.dwFlags = (chn.dwFlags & CHN_CHANNELFLAGS) | smp.uFlags; - chn.nLoopStart = smp.nLoopStart; - chn.nLoopEnd = smp.nLoopEnd; - chn.nLength = smp.uFlags[CHN_LOOP] ? smp.nLoopEnd : smp.nLength; - chn.nPos = chn.nLoopStart; - UpdateLookaheadPointers(samplePointer, lookaheadPointer, lookaheadStart, chn, resamplingMode); - if(!chn.pCurrentSample) + if(chn.nNewIns && chn.nNewIns <= GetNumSamples() && chn.pModSample != &Samples[chn.nNewIns]) { - break; + // ProTracker compatibility: Instrument changes without a note do not happen instantly, but rather when the sample loop has finished playing. + // Test case: PTInstrSwap.mod + const ModSample &smp = Samples[chn.nNewIns]; + chn.pModSample = &smp; + chn.pCurrentSample = smp.pSample; + chn.dwFlags = (chn.dwFlags & CHN_CHANNELFLAGS) | smp.uFlags; + chn.nLength = smp.uFlags[CHN_LOOP] ? smp.nLoopEnd : smp.nLength; + chn.nLoopStart = smp.nLoopStart; + chn.nLoopEnd = smp.nLoopEnd; + chn.nPos = chn.nLoopStart; + UpdateLookaheadPointers(samplePointer, lookaheadPointer, lookaheadStart, chn, resamplingMode); + if(!chn.pCurrentSample) + { + break; + } + } else if(chn.nLoopStart == 0) + { + // ProTracker "oneshot" loops (if loop start is 0, play the whole sample once and then repeat until loop end) + chn.nPos = 0; + chn.nPosLo = 0; + chn.nLoopEnd = chn.nLength = chn.pModSample->nLoopEnd; } } } while(nsamples > 0); Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-04-11 12:53:11 UTC (rev 4923) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-04-11 13:44:32 UTC (rev 4924) @@ -255,7 +255,7 @@ } } - // If samples are being synced , force them to resync if tick duration changes + // If samples are being synced, force them to resync if tick duration changes uint32 oldTickDuration = 0; for (;;) @@ -1262,6 +1262,8 @@ pChn->nLength = pSmp->nLength; pChn->nLoopStart = pSmp->nLoopStart; pChn->nLoopEnd = pSmp->nLoopEnd; + // ProTracker "oneshot" loops (if loop start is 0, play the whole sample once and then repeat until loop end) + if(m_SongFlags[SONG_PT1XMODE] && pChn->nLoopStart == 0) pChn->nLoopEnd = pSmp->nLength; pChn->dwFlags |= (pSmp->uFlags & (CHN_SAMPLEFLAGS | CHN_SURROUND)); // IT Compatibility: Autovibrato reset @@ -1495,6 +1497,8 @@ pChn->nLoopEnd = pSmp->nLoopEnd; if (pChn->nLength > pChn->nLoopEnd) pChn->nLength = pChn->nLoopEnd; } + // ProTracker "oneshot" loops (if loop start is 0, play the whole sample once and then repeat until loop end) + if(m_SongFlags[SONG_PT1XMODE] && pChn->nLoopStart == 0) pChn->nLoopEnd = pChn->nLength = pSmp->nLength; if(pChn->dwFlags[CHN_REVERSE]) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |