From: <sag...@us...> - 2013-02-03 20:58:32
|
Revision: 1513 http://sourceforge.net/p/modplug/code/1513 Author: saga-games Date: 2013-02-03 20:58:24 +0000 (Sun, 03 Feb 2013) Log Message: ----------- [Fix] FT2 compatibility: Reverted envelope handling to pre-1.20 behaviour to fix EnvOff.xm (modelld after gh-kott.xm, where I noticed that the old behaviour was correct). EnvLoops.xm is no longer passed because of this change. Modified Paths: -------------- trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp 2013-02-02 22:36:22 UTC (rev 1512) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2013-02-03 20:58:24 UTC (rev 1513) @@ -575,20 +575,20 @@ SAMPLEINDEX numLoopOpt = 0; - for (SAMPLEINDEX nSmp = 1; nSmp <= pSndFile->GetNumSamples(); nSmp++) + for(SAMPLEINDEX smp = 1; smp <= pSndFile->GetNumSamples(); smp++) { - const ModSample &sample = pSndFile->GetSample(nSmp); + const ModSample &sample = pSndFile->GetSample(smp); // Determine how much of the sample will be played SmpLength loopLength = sample.nLength; - if(sample.uFlags & CHN_LOOP) + if(sample.uFlags[CHN_LOOP]) { loopLength = sample.nLoopEnd; + if(sample.uFlags[CHN_SUSTAINLOOP]) + { + loopLength = Util::Max(sample.nLoopEnd, sample.nSustainEnd); + } } - if(sample.uFlags & CHN_SUSTAINLOOP) - { - loopLength = Util::Max(sample.nLoopEnd, sample.nSustainEnd); - } if(sample.pSample && sample.nLength > loopLength + 2) numLoopOpt++; } @@ -605,12 +605,12 @@ // Determine how much of the sample will be played SmpLength loopLength = sample.nLength; - if(sample.uFlags & CHN_LOOP) + if(sample.uFlags[CHN_LOOP]) { loopLength = sample.nLoopEnd; // Sustain loop is played before normal loop, and it can actually be located after the normal loop. - if(sample.uFlags & CHN_SUSTAINLOOP) + if(sample.uFlags[CHN_SUSTAINLOOP]) { loopLength = Util::Max(sample.nLoopEnd, sample.nSustainEnd); } @@ -631,7 +631,7 @@ return true; } - return false; + return false; } // Rearrange sample list @@ -677,7 +677,7 @@ deleteInstrumentSamples removeSamples = doNoDeleteAssociatedSamples; if(!pSndFile->m_SongFlags[SONG_ITPROJECT]) // Never remove an instrument's samples in ITP. { - if(Reporting::Confirm("Remove samples associated with an instrument if they are unused?", "Removing unused instruments", false, false, this) == cnfYes) + if(Reporting::Confirm("Remove samples associated with unused instruments?", "Removing unused instruments", false, false, this) == cnfYes) { removeSamples = deleteAssociatedSamples; } Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2013-02-02 22:36:22 UTC (rev 1512) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2013-02-03 20:58:24 UTC (rev 1513) @@ -1139,12 +1139,12 @@ { const ModInstrument *pIns = pChn->pModInstrument; - if(IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2) && pChn->VolEnv.nEnvPosition == 0) + if(IsCompatibleMode(TRK_IMPULSETRACKER) && pChn->VolEnv.nEnvPosition == 0) { // If the envelope is disabled at the very same moment as it is triggered, we do not process anything. return; } - const int envpos = pChn->VolEnv.nEnvPosition - (IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2) ? 1 : 0); + const int envpos = pChn->VolEnv.nEnvPosition - (IsCompatibleMode(TRK_IMPULSETRACKER) ? 1 : 0); // Get values in [0, 256] int envval = Util::Round<int>(pIns->VolEnv.GetValueFromPosition(envpos) * 256.0f); @@ -1269,7 +1269,7 @@ } // Increase position - UINT position = chnEnv.nEnvPosition + (IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2) ? 0 : 1); + UINT position = chnEnv.nEnvPosition + (IsCompatibleMode(TRK_IMPULSETRACKER) ? 0 : 1); const InstrumentEnvelope &insEnv = pChn->pModInstrument->GetEnvelope(envType); @@ -1371,7 +1371,7 @@ } } - chnEnv.nEnvPosition = position + (IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2) ? 1 : 0); + chnEnv.nEnvPosition = position + (IsCompatibleMode(TRK_IMPULSETRACKER) ? 1 : 0); } @@ -2027,7 +2027,7 @@ // Process Envelopes if (pIns) { - if(IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2)) + if(IsCompatibleMode(TRK_IMPULSETRACKER)) { // In IT and FT2 compatible mode, envelope position indices are shifted by one for proper envelope pausing, // so we have to update the position before we actually process the envelopes. @@ -2184,7 +2184,7 @@ } // Increment envelope positions - if (pIns != nullptr && !IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2)) + if(pIns != nullptr && !IsCompatibleMode(TRK_IMPULSETRACKER)) { // In IT and FT2 compatible mode, envelope positions are updated above. // Test cases: s77.it, EnvLoops.xm This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |