From: <sag...@us...> - 2012-01-09 23:08:20
|
Revision: 1163 http://modplug.svn.sourceforge.net/modplug/?rev=1163&view=rev Author: saga-games Date: 2012-01-09 23:08:13 +0000 (Mon, 09 Jan 2012) Log Message: ----------- [Fix] XM Compatibility: Out-of-range notes should actually not be played at all (http://bugs.openmpt.org/view.php?id=217). Test case: note-limit.xm [Mod] OpenMPT: Version is now 1.20.00.62 Modified Paths: -------------- trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2012-01-08 22:04:33 UTC (rev 1162) +++ trunk/OpenMPT/mptrack/version.h 2012-01-09 23:08:13 UTC (rev 1163) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 00 -#define VER_MINORMINOR 61 +#define VER_MINORMINOR 62 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-01-08 22:04:33 UTC (rev 1162) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-01-09 23:08:13 UTC (rev 1163) @@ -793,8 +793,7 @@ pChn->nC5Speed = pSmp->nC5Speed; pChn->m_CalculateFreq = true; pChn->nFineTune = 0; - } - else + } else { pChn->nC5Speed = pSmp->nC5Speed; pChn->nFineTune = pSmp->nFineTune; @@ -839,7 +838,7 @@ MODSAMPLE *pSmp = pChn->pModSample; MODINSTRUMENT *pIns = pChn->pModInstrument; - const bool bNewTuning = (GetType() == MOD_TYPE_MPT && pIns != nullptr && pIns->pTuning); + const bool newTuning = (GetType() == MOD_TYPE_MPT && pIns != nullptr && pIns->pTuning); // save the note that's actually used, as it's necessary to properly calculate PPS and stuff const int realnote = note; @@ -879,7 +878,7 @@ return; } - if(bNewTuning) + if(newTuning) { if(!bPorta || pChn->nNote == NOTE_NONE) pChn->nPortamentoDest = 0; @@ -921,7 +920,7 @@ if (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2|MOD_TYPE_MED)) { note += pChn->nTranspose; - Limit(note, NOTE_MIN, 131); // why 131? 120+11, how does this make sense? + Limit(note, NOTE_MIN + 11, NOTE_MIN + 130); // why 131? 120+11, how does this make sense? } else { Limit(note, NOTE_MIN, NOTE_MAX); @@ -945,7 +944,7 @@ if (period) { if ((!bPorta) || (!pChn->nPeriod)) pChn->nPeriod = period; - if(!bNewTuning) pChn->nPortamentoDest = period; + if(!newTuning) pChn->nPortamentoDest = period; if ((!bPorta) || ((!pChn->nLength) && (!(GetType() & MOD_TYPE_S3M)))) { pChn->pModSample = pSmp; @@ -1549,8 +1548,27 @@ { UINT note = pChn->rowCommand.note; if (instr) pChn->nNewIns = instr; - bool retrigEnv = (!note) && (instr); + // Notes that exceed FT2's limit are completely ignored. + // Test case: note-limit.xm + if(note != NOTE_NONE && NOTE_IS_VALID(note) && IsCompatibleMode(TRK_FASTTRACKER2)) + { + const int computedNote = note + pChn->nTranspose; + if((computedNote < NOTE_MIN + 11 || computedNote > NOTE_MIN + 130)) + { + note = NOTE_NONE; + } + } + + // XM: FT2 ignores a note next to a K00 effect, and a fade-out seems to be done when no volume envelope is present (not exactly the Kxx behaviour) + if(cmd == CMD_KEYOFF && param == 0 && IsCompatibleMode(TRK_FASTTRACKER2)) + { + note = NOTE_NONE; + instr = 0; + } + + bool retrigEnv = note == NOTE_NONE && instr != 0; + // Apparently, any note number in a pattern causes instruments to recall their original volume settings - no matter if there's a Note Off next to it or whatever. // Test cases: keyoff+instr.xm, delay.xm bool reloadSampleSettings = (IsCompatibleMode(TRK_FASTTRACKER2) && instr != 0); @@ -1559,19 +1577,14 @@ // Now it's time for some FT2 crap... if (GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2)) { - // XM: FT2 ignores a note next to a K00 effect, and a fade-out seems to be done when no volume envelope is present (not exactly the Kxx behaviour) - if(cmd == CMD_KEYOFF && param == 0 && IsCompatibleMode(TRK_FASTTRACKER2)) - { - note = instr = 0; - retrigEnv = false; - } // XM: Key-Off + Sample == Note Cut (BUT: Only if no instr number or volume effect is present!) if ((note == NOTE_KEYOFF) && ((!instr && volcmd == VOLCMD_NONE && cmd != CMD_VOLUME) || !IsCompatibleMode(TRK_FASTTRACKER2)) && ((!pChn->pModInstrument) || (!(pChn->pModInstrument->VolEnv.dwFlags & ENV_ENABLED)))) { pChn->dwFlags |= CHN_FASTVOLRAMP; pChn->nVolume = 0; - note = instr = 0; + note = NOTE_NONE; + instr = 0; retrigEnv = false; } else if(IsCompatibleMode(TRK_FASTTRACKER2) && !(m_dwSongFlags & SONG_FIRSTTICK)) { @@ -1604,6 +1617,7 @@ reloadSampleSettings = true; } } + } if((retrigEnv && !IsCompatibleMode(TRK_FASTTRACKER2)) || reloadSampleSettings) @@ -1703,8 +1717,8 @@ InstrumentChange(pChn, instr, bPorta, true); pChn->nNewIns = 0; // Special IT case: portamento+note causes sample change -> ignore portamento - if ((m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) - && (psmp != pChn->pModSample) && (note) && (note < 0x80)) + if ((GetType() & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) + && (psmp != pChn->pModSample) && (note) && (note < 0x80)) { bPorta = false; } @@ -1714,11 +1728,11 @@ { if ((!instr) && (pChn->nNewIns) && (note < 0x80)) { - InstrumentChange(pChn, pChn->nNewIns, bPorta, false, (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)) ? false : true); + InstrumentChange(pChn, pChn->nNewIns, bPorta, false, (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2)) == 0); pChn->nNewIns = 0; } - NoteChange(nChn, note, bPorta, (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)) ? false : true); - if ((bPorta) && (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)) && (instr)) + NoteChange(nChn, note, bPorta, (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2)) == 0); + if ((bPorta) && (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2)) && (instr)) { pChn->dwFlags |= CHN_FASTVOLRAMP; ResetChannelEnvelopes(pChn); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |