From: <sag...@us...> - 2012-02-26 17:38:26
|
Revision: 1198 http://modplug.svn.sourceforge.net/modplug/?rev=1198&view=rev Author: saga-games Date: 2012-02-26 17:38:19 +0000 (Sun, 26 Feb 2012) Log Message: ----------- [Fix] S3M / MOD: Amiga limits are now enfored on the stored period, not only the computed period. [Ref] Moved some more stuff around to more appropriate places. [Mod] OpenMPT: Version is now 1.20.00.72 Modified Paths: -------------- trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/ModChannel.h trunk/OpenMPT/soundlib/ModInstrument.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2012-02-26 00:31:46 UTC (rev 1197) +++ trunk/OpenMPT/mptrack/version.h 2012-02-26 17:38:19 UTC (rev 1198) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 00 -#define VER_MINORMINOR 71 +#define VER_MINORMINOR 72 //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/ModChannel.h =================================================================== --- trunk/OpenMPT/soundlib/ModChannel.h 2012-02-26 00:31:46 UTC (rev 1197) +++ trunk/OpenMPT/soundlib/ModChannel.h 2012-02-26 17:38:19 UTC (rev 1198) @@ -16,6 +16,12 @@ DWORD nEnvPosition; DWORD flags; LONG nEnvValueAtReleaseJump; + + void Reset() + { + nEnvPosition = 0; + nEnvValueAtReleaseJump = NOT_YET_RELEASED; + } }; Modified: trunk/OpenMPT/soundlib/ModInstrument.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModInstrument.cpp 2012-02-26 00:31:46 UTC (rev 1197) +++ trunk/OpenMPT/soundlib/ModInstrument.cpp 2012-02-26 17:38:19 UTC (rev 1198) @@ -49,18 +49,17 @@ Ticks[node + 1] = Ticks[node]; Values[node + 1] = Values[node]; } + + nNodes++; } Ticks[nLoopEnd]--; - Values[nLoopEnd] = (BYTE)interpolatedValue; - - nNodes++; + Values[nLoopEnd] = interpolatedValue; } else { - // There is already a point before the loop point: Use it as loop end. + // There is already a point before the loop point: Use it as new loop end. nLoopEnd--; } - } } }; @@ -104,7 +103,7 @@ if(x2 > x1 && position > x1) { // Linear approximation between the points; - // f(x+d) ~ f(x) + f'(x)*d, where f'(x) = (y2-y1) / (x2-x1) + // f(x + d) ~ f(x) + f'(x) * d, where f'(x) = (y2 - y1) / (x2 - x1) value += ((position - x1) * (static_cast<float>(Values[pt]) / 64.0f - value)) / (x2 - x1); } } Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-02-26 00:31:46 UTC (rev 1197) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-02-26 17:38:19 UTC (rev 1198) @@ -705,9 +705,9 @@ pChn->dwFlags |= CHN_FASTVOLRAMP; if ((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && (!instrumentChanged) && (pIns) && (!(pChn->dwFlags & (CHN_KEYOFF|CHN_NOTEFADE)))) { - if (!(pIns->VolEnv.dwFlags & ENV_CARRY)) ResetChannelEnvelope(pChn->VolEnv); - if (!(pIns->PanEnv.dwFlags & ENV_CARRY)) ResetChannelEnvelope(pChn->PanEnv); - if (!(pIns->PitchEnv.dwFlags & ENV_CARRY)) ResetChannelEnvelope(pChn->PitchEnv); + if (!(pIns->VolEnv.dwFlags & ENV_CARRY)) pChn->VolEnv.Reset(); + if (!(pIns->PanEnv.dwFlags & ENV_CARRY)) pChn->PanEnv.Reset(); + if (!(pIns->PitchEnv.dwFlags & ENV_CARRY)) pChn->PitchEnv.Reset(); } else { ResetChannelEnvelopes(pChn); @@ -722,7 +722,7 @@ { if(IsCompatibleMode(TRK_IMPULSETRACKER)) { - ResetChannelEnvelope(pChn->VolEnv); + pChn->VolEnv.Reset(); } else { ResetChannelEnvelopes(pChn); @@ -1058,9 +1058,9 @@ // IT Compatiblity: NNA is reset on every note change, not every instrument change (fixes spx-farspacedance.it). if(IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nNNA = pIns->nNNA; - if (!(pIns->VolEnv.dwFlags & ENV_CARRY)) ResetChannelEnvelope(pChn->VolEnv); - if (!(pIns->PanEnv.dwFlags & ENV_CARRY)) ResetChannelEnvelope(pChn->PanEnv); - if (!(pIns->PitchEnv.dwFlags & ENV_CARRY)) ResetChannelEnvelope(pChn->PitchEnv); + if (!(pIns->VolEnv.dwFlags & ENV_CARRY)) pChn->VolEnv.Reset(); + if (!(pIns->PanEnv.dwFlags & ENV_CARRY)) pChn->PanEnv.Reset(); + if (!(pIns->PitchEnv.dwFlags & ENV_CARRY)) pChn->PitchEnv.Reset(); if (GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT)) { @@ -2373,20 +2373,12 @@ void CSoundFile::ResetChannelEnvelopes(ModChannel *pChn) const //------------------------------------------------------------ { - ResetChannelEnvelope(pChn->VolEnv); - ResetChannelEnvelope(pChn->PanEnv); - ResetChannelEnvelope(pChn->PitchEnv); + pChn->VolEnv.Reset(); + pChn->PanEnv.Reset(); + pChn->PitchEnv.Reset(); } -void CSoundFile::ResetChannelEnvelope(ModChannelEnvInfo &env) const -//------------------------------------------------------------------ -{ - env.nEnvPosition = 0; - env.nEnvValueAtReleaseJump = NOT_YET_RELEASED; -} - - //////////////////////////////////////////////////////////// // Channels effects Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2012-02-26 00:31:46 UTC (rev 1197) +++ trunk/OpenMPT/soundlib/Sndfile.h 2012-02-26 17:38:19 UTC (rev 1198) @@ -708,7 +708,6 @@ public: void ResetChannelEnvelopes(ModChannel *pChn) const; - void ResetChannelEnvelope(ModChannelEnvInfo &env) const; private: PLUGINDEX __cdecl GetChannelPlugin(CHANNELINDEX nChn, PluginMutePriority respectMutes) const; Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2012-02-26 00:31:46 UTC (rev 1197) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2012-02-26 17:38:19 UTC (rev 1198) @@ -925,6 +925,7 @@ case 1: // IT compatibility: IT has its own, more precise tables + // XXX ModRampDownTable should be negated for XM *Vibrato* (not for Tremolo, though!) return IsCompatibleMode(TRK_IMPULSETRACKER) ? ITRampDownTable[position] : ModRampDownTable[position]; case 2: @@ -1238,6 +1239,7 @@ if(envType == ENV_VOLUME && insEnv.nLoopStart == insEnv.nLoopEnd && insEnv.Values[insEnv.nLoopEnd] == 0 && (!(GetType() & MOD_TYPE_XM) || (insEnv.nLoopEnd + 1u == insEnv.nNodes))) { + // Stop channel if the envelope loop only covers the last silent envelope point. pChn->dwFlags |= CHN_NOTEFADE; pChn->nFadeOutVol = 0; } @@ -1304,6 +1306,7 @@ if(insEnv.Values[insEnv.nNodes - 1] == 0 && (pChn->nMasterChn > 0 || (GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)))) { + // Stop channel if the last envelope node is silent anyway. pChn->dwFlags |= CHN_NOTEFADE; pChn->nFadeOutVol = 0; pChn->nRealVolume = 0; @@ -1394,6 +1397,7 @@ #ifndef NO_VST #if 0 // EXPERIMENTAL VSTi arpeggio. Far from perfect! + // Note: We could use pChn->nLastNote here to simplify things. if(pChn->pModInstrument && pChn->pModInstrument->nMixPlug && !(m_dwSongFlags & SONG_FIRSTTICK)) { const ModInstrument *pIns = pChn->pModInstrument; @@ -1430,7 +1434,7 @@ #endif // 0 #endif // NO_VST - if((m_nType & MOD_TYPE_MPT) && pChn->pModInstrument && pChn->pModInstrument->pTuning) + if((GetType() & MOD_TYPE_MPT) && pChn->pModInstrument && pChn->pModInstrument->pTuning) { switch(m_nTickCount % 3) { @@ -1478,8 +1482,8 @@ } } - if (note > 109 && arpPos != 0) - note = 109; // FT2's note limit + if (note > 108 + NOTE_MIN && arpPos != 0) + note = 108 + NOTE_MIN; // FT2's note limit period = GetPeriodFromNote(note, pChn->nFineTune, pChn->nC5Speed); @@ -2023,7 +2027,7 @@ if (pChn->nPeriod < m_nMinPeriod) pChn->nPeriod = m_nMinPeriod; period = pChn->nPeriod; // TODO Glissando effect is reset after portamento! What would this sound like without the CHN_PORTAMENTO flag? - if ((pChn->dwFlags & (CHN_GLISSANDO|CHN_PORTAMENTO)) == (CHN_GLISSANDO|CHN_PORTAMENTO)) + if ((pChn->dwFlags & (CHN_GLISSANDO | CHN_PORTAMENTO)) == (CHN_GLISSANDO | CHN_PORTAMENTO)) { period = GetPeriodFromNote(GetNoteFromPeriod(period), pChn->nFineTune, pChn->nC5Speed); } @@ -2031,9 +2035,11 @@ ProcessArpeggio(pChn, period, arpeggioSteps); // Preserve Amiga freq limits - if (m_dwSongFlags & (SONG_AMIGALIMITS|SONG_PT1XMODE)) + // Test case: AmigaLimits.s3m + if (m_dwSongFlags & (SONG_AMIGALIMITS | SONG_PT1XMODE)) { Limit(period, 113 * 4, 856 * 4); + Limit(pChn->nPeriod, 113 * 4, 856 * 4); } ProcessPanbrello(pChn); @@ -2062,6 +2068,8 @@ // Final Period if (period <= m_nMinPeriod) { + // ST3 simply stops playback if frequency is too high. + // Test case: FreqLimits.s3m if (GetType() & MOD_TYPE_S3M) pChn->nLength = 0; period = m_nMinPeriod; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |