From: <sag...@us...> - 2009-07-12 14:17:42
|
Revision: 294 http://modplug.svn.sourceforge.net/modplug/?rev=294&view=rev Author: saga-games Date: 2009-07-12 14:17:41 +0000 (Sun, 12 Jul 2009) Log Message: ----------- [Fix] S3M saving: Clamp sample pre-amp to [32;127] instead of just taking the lower 7 bits. (Default pre-amp value as 128, which resulted in pre-amp 0 when saving) [Imp] IT loading: Set "created with" version to 1.16 for modules that have been saved with ModPlug 1.16 or older [Fix] IT compatibility: Improved retrigger compatibility even more (#15) [Fix] IT compatibility: SD0 / SC0 is now interpreted as SD1 / SC1 in compatibility mode (test #22) [Fix] S3M compatibility: Notes with SD0 are now ignored, SC0 is completely ignored [Fix] IT compatibility: Portamento up / down resets the destination of tone portamento (test #23) Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_s3m.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2009-07-12 12:25:38 UTC (rev 293) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2009-07-12 14:17:41 UTC (rev 294) @@ -2694,7 +2694,11 @@ break; case 0xC0: // note cut case 0xD0: // note delay - strcat(s, " frames"); + //IT compatibility 22. SD0 == SD1, SC0 == SC1 + if(((param & 0x0F) == 1) || ((param & 0x0F) == 0 && (m_SndFile.GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT)) && m_SndFile.GetModFlag(MSF_COMPATIBLE_PLAY))) + strcpy(s, "1 frame"); + else + strcat(s, " frames"); break; case 0xE0: // pattern delay (rows) strcat(s, " rows"); Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2009-07-12 12:25:38 UTC (rev 293) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2009-07-12 14:17:41 UTC (rev 294) @@ -962,6 +962,8 @@ (pifh->cwtv == 0x217 && pifh->cmwt == 0x200)) interpretModplugmade = true; //TODO: Check whether above interpretation is reasonable especially for //values 0x217 and 0x200 which are the values used in 1.16. + if(pifh->cwtv == 0x217 && pifh->cmwt == 0x200) + m_dwCreatedWithVersion = MAKE_VERSION_NUMERIC(1, 16, 0, 0); } } Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp 2009-07-12 12:25:38 UTC (rev 293) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2009-07-12 14:17:41 UTC (rev 294) @@ -531,7 +531,7 @@ header[0x30] = m_nDefaultGlobalVolume >> 2; header[0x31] = m_nDefaultSpeed; header[0x32] = m_nDefaultTempo; - header[0x33] = ((m_nSamplePreAmp < 0x20) ? 0x20 : m_nSamplePreAmp) | 0x80; // Stereo + header[0x33] = min(max(0x20, m_nSamplePreAmp), 0x7F); // Stereo header[0x35] = 0xFC; for (i=0; i<32; i++) { Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-07-12 12:25:38 UTC (rev 293) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-07-12 14:17:41 UTC (rev 294) @@ -298,7 +298,7 @@ if (!(m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))) param <<= 1; if(GetModFlag(MSF_COMPATIBLE_PLAY)) { - // both FT2 and IT ignore out-of-range values + //IT compatibility 16. Both FT2 and IT ignore out-of-range values if (param <= 128) nGlbVol = param << 1; } @@ -312,6 +312,7 @@ case CMD_GLOBALVOLSLIDE: if(GetModFlag(MSF_COMPATIBLE_PLAY)) { + //IT compatibility 16. Global volume slide params are stored per channel (FT2/IT) if (param) pChn->nOldGlobalVolSlide = param; else param = pChn->nOldGlobalVolSlide; } else @@ -746,6 +747,7 @@ pChn->dwFlags |= CHN_FASTVOLRAMP; if(!GetModFlag(MSF_COMPATIBLE_PLAY)) { + //IT compatibility 15. Retrigger (Tremor doesn't store anything here, so we just don't reset this as well) pChn->nRetrigCount = 0; pChn->nTremorCount = 0; } @@ -1164,6 +1166,15 @@ if ((param & 0xF0) == 0xD0) { nStartTick = param & 0x0F; + if(nStartTick == 0) + { + //IT compatibility 22. SD0 == SD1 + if(GetModFlag(MSF_COMPATIBLE_PLAY) && (m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) + nStartTick = 1; + //ST3 ignores notes with SD0 completely + else if(m_nType & MOD_TYPE_S3M|MOD_TYPE_MPT) + nStartTick = m_nMusicSpeed; + } //IT compatibility 08. Handling of out-of-range delay command. if(nStartTick >= m_nMusicSpeed && GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT) && GetModFlag(MSF_COMPATIBLE_PLAY)) @@ -1397,6 +1408,7 @@ break; case VOLCMD_PORTAUP: + //IT compatibility (one of the first - link effect memory) if((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && GetModFlag(MSF_COMPATIBLE_PLAY)) PortamentoUp(pChn, vol << 2, true); else @@ -1404,6 +1416,7 @@ break; case VOLCMD_PORTADOWN: + //IT compatibility (one of the first - link effect memory) if((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && GetModFlag(MSF_COMPATIBLE_PLAY)) PortamentoDown(pChn, vol << 2, true); else @@ -1535,21 +1548,22 @@ } if(!GetModFlag(MSF_COMPATIBLE_PLAY)) { - if (param) pChn->nRetrigParam = (BYTE)(param & 0xFF); else param = pChn->nRetrigParam; - //rewbs.volOffset - //RetrigNote(nChn, param); - if (volcmd == VOLCMD_OFFSET) - RetrigNote(nChn, param, vol<<3); - else if (volcmd == VOLCMD_VELOCITY) - RetrigNote(nChn, param, 48-(vol << 3)); - else - RetrigNote(nChn, param); - //end rewbs.volOffset: + if (param) pChn->nRetrigParam = (BYTE)(param & 0xFF); else param = pChn->nRetrigParam; + //rewbs.volOffset + //RetrigNote(nChn, param); + if (volcmd == VOLCMD_OFFSET) + RetrigNote(nChn, param, vol<<3); + else if (volcmd == VOLCMD_VELOCITY) + RetrigNote(nChn, param, 48-(vol << 3)); + else + RetrigNote(nChn, param); + //end rewbs.volOffset: } else { - if (param) pChn->nRetrigParam = (BYTE)(param & 0xFF); - RetrigNote(nChn, pChn->nRetrigParam); + //IT compatibility 15. Retrigger + if (param) pChn->nRetrigParam = (BYTE)(param & 0xFF); + RetrigNote(nChn, pChn->nRetrigParam); } break; @@ -1567,7 +1581,7 @@ if (!(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) param <<= 1; if(GetModFlag(MSF_COMPATIBLE_PLAY)) { - // both FT2 and IT ignore out-of-range values + //IT compatibility 16. Both FT2 and IT ignore out-of-range values if (param <= 128) m_nGlobalVolume = param << 1; } @@ -1580,6 +1594,7 @@ // Global Volume Slide case CMD_GLOBALVOLSLIDE: + //IT compatibility 16. Saving last global volume slide param per channel (FT2/IT) if(GetModFlag(MSF_COMPATIBLE_PLAY)) GlobalVolSlide(param, &pChn->nOldGlobalVolSlide); else @@ -1636,7 +1651,7 @@ case CMD_KEYOFF: if(GetModFlag(MSF_COMPATIBLE_PLAY) && (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2))) { - // This is how it's supposed to sound... + // This is how it's supposed to sound... (in FT2) if (m_nTickCount == param) { // XM: Key-Off + Sample == Note Cut @@ -1698,6 +1713,7 @@ if(!GetModFlag(MSF_COMPATIBLE_PLAY) || !(m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2))) { + // FT2 only sets the position of the Volume envelope pChn->nPanEnvPosition = param; pChn->nPitchEnvPosition = param; if (pChn->pHeader) @@ -1905,6 +1921,10 @@ { DoFreqSlide(pChn, -(int)(param * 4)); } + + //IT compatibility 23. Portamento with no note + if((m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) && GetModFlag(MSF_COMPATIBLE_PLAY)) + pChn->nPortamentoDest = 0; } @@ -1947,6 +1967,9 @@ DoFreqSlide(pChn, (int)(param << 2)); } + //IT compatibility 23. Portamento with no note + if((m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) && GetModFlag(MSF_COMPATIBLE_PLAY)) + pChn->nPortamentoDest = 0; } void CSoundFile::MidiPortamento(MODCHANNEL *pChn, int param) @@ -2381,6 +2404,7 @@ //case 0x80: if (!m_nTickCount) { pChn->nPan = (param << 4) + 8; pChn->dwFlags |= CHN_FASTVOLRAMP; } break; case 0x80: if (!m_nTickCount) { + //IT compatibility (Panning always resets surround state) if( TypeIsIT_MPT_XM() == false || GetModFlag(MSF_COMPATIBLE_PLAY) ) { if (!(m_dwSongFlags & SONG_SURROUNDPAN)) pChn->dwFlags &= ~CHN_SURROUND; @@ -2951,7 +2975,7 @@ if(GetModFlag(MSF_COMPATIBLE_PLAY) && (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))) { - // IT retrigger behaviour + //IT compatibility 15. Retrigger if (!m_nTickCount && pChn->nRowNote) { pChn->nRetrigCount = param & 0xf; @@ -3075,6 +3099,16 @@ void CSoundFile::NoteCut(UINT nChn, UINT nTick) //--------------------------------------------- { + if(nTick == 0) + { + //IT compatibility 22. SC0 == SC1 + if(GetModFlag(MSF_COMPATIBLE_PLAY) && (m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) + nTick = 1; + // ST3 doesn't cut notes with SC0 + else if(m_nType & MOD_TYPE_S3M) + return; + } + if (m_nTickCount == nTick) { MODCHANNEL *pChn = &Chn[nChn]; Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2009-07-12 12:25:38 UTC (rev 293) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2009-07-12 14:17:41 UTC (rev 294) @@ -636,6 +636,12 @@ Chn[ich].dwFlags = ChnSettings[ich].dwFlags; Chn[ich].nVolume = 256; Chn[ich].nCutOff = 0x7F; + //IT compatibility 15. Retrigger + if(GetModFlag(MSF_COMPATIBLE_PLAY)) + { + Chn[ich].nRetrigParam = 1; + Chn[ich].nRetrigCount = 0; + } } // Checking instruments MODINSTRUMENT *pins = Ins; @@ -1135,7 +1141,13 @@ Chn[j].nCommand = 0; Chn[j].nPatternLoopCount = 0; Chn[j].nPatternLoop = 0; - if(!GetModFlag(MSF_COMPATIBLE_PLAY)) Chn[j].nTremorCount = 0; + //IT compatibility 15. Retrigger + if(GetModFlag(MSF_COMPATIBLE_PLAY)) + { + Chn[j].nRetrigCount = 0; + Chn[j].nRetrigParam = 1; + } + Chn[j].nTremorCount = Chn[j].nTremorOn = Chn[j].nTremorOff = 0; } if (!nPos) { @@ -1395,6 +1407,12 @@ Chn[i].nPatternLoop = 0; Chn[i].nFadeOutVol = 0; Chn[i].dwFlags |= CHN_KEYOFF|CHN_NOTEFADE; + //IT compatibility 15. Retrigger + if(GetModFlag(MSF_COMPATIBLE_PLAY)) + { + Chn[i].nRetrigParam = 1; + Chn[i].nRetrigCount = 0; + } Chn[i].nTremorCount = Chn[i].nTremorOn = Chn[i].nTremorOff = 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |