From: <sag...@us...> - 2012-01-14 20:57:23
|
Revision: 1165 http://modplug.svn.sourceforge.net/modplug/?rev=1165&view=rev Author: saga-games Date: 2012-01-14 20:57:16 +0000 (Sat, 14 Jan 2012) Log Message: ----------- [Fix] IT Compatibility: A Z7F next to a note seems to reset the filter immediately (test cases: filter-reset.it, filter-reset-carry.it) [Fix] IT Compatibility: Envelope carry pickup after SCx (test case: cut-carry.it) [Mod] OpenMPT: Version is now 1.20.00.63 Modified Paths: -------------- trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Snd_flt.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2012-01-14 14:58:51 UTC (rev 1164) +++ trunk/OpenMPT/mptrack/version.h 2012-01-14 20:57:16 UTC (rev 1165) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 00 -#define VER_MINORMINOR 62 +#define VER_MINORMINOR 63 //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_flt.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_flt.cpp 2012-01-14 14:58:51 UTC (rev 1164) +++ trunk/OpenMPT/soundlib/Snd_flt.cpp 2012-01-14 20:57:16 UTC (rev 1165) @@ -57,26 +57,31 @@ float d, e; - if(UseITFilterMode()) - { + // flt_modifier is in [-256, 256], so cutoff is in [0, 127 * 2] after this calculation. + const int computedCutoff = cutoff * (flt_modifier + 256) / 256; - // flt_modifier is in [-256, 256], so cutoff is in [0, 127 * 2] after this calculation - cutoff = cutoff * (flt_modifier + 256) / 256; - - // Filtering is only ever done if either cutoff is not full or if resonance is set. - if(cutoff < 254 || resonance != 0) + // Filtering is only ever done in IT if either cutoff is not full or if resonance is set. + if(IsCompatibleMode(TRK_IMPULSETRACKER) && resonance == 0 && computedCutoff >= 254) + { + if(pChn->rowCommand.note != NOTE_NONE && NOTE_IS_VALID(pChn->rowCommand.note) && !(pChn->dwFlags & CHN_PORTAMENTO)) { - pChn->dwFlags |= CHN_FILTER; - } else - { - return; + // Z7F next to a note disables the filter, however in other cases this should not happen. + // Test cases: filter-reset.it, filter-reset-carry.it + pChn->dwFlags &= ~CHN_FILTER; } + return; + } + pChn->dwFlags |= CHN_FILTER; + + if(UseITFilterMode()) + { + static const float freqMultiplier = 2.0f * (float)M_PI * 110.0f * pow(2.0f, 0.25f); static const float freqParameterMultiplier = 128.0f / (24.0f * 256.0f); // 2 ^ (i / 24 * 256) - const float r = (float)gdwMixingFreq / (freqMultiplier * pow(2.0f, (float)cutoff * freqParameterMultiplier)); + const float r = (float)gdwMixingFreq / (freqMultiplier * pow(2.0f, (float)computedCutoff * freqParameterMultiplier)); d = ITResonanceTable[resonance] * r + ITResonanceTable[resonance] - 1.0f; e = r * r; @@ -84,14 +89,6 @@ } else { - // We might end up here even if IT compatible playback mode is enabled and if extended filter range flag is set. - // We'd still want compatible behaviour then, but at the same time use MPT's cutoff / resonance settings - if(IsCompatibleMode(TRK_IMPULSETRACKER) && resonance == 0 && cutoff * (flt_modifier + 256) >= 254 * 256) - { - return; - } - pChn->dwFlags |= CHN_FILTER; - float fc = (float)CutOffToFrequency(cutoff, flt_modifier); const float dmpfac = pow(10.0f, -((24.0f / 128.0f) * (float)resonance) / 20.0f); Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-01-14 14:58:51 UTC (rev 1164) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-01-14 20:57:16 UTC (rev 1165) @@ -466,7 +466,7 @@ } else if (((param & 0xF0) == 0xF0) && (param & 0x0F)) { - if (memory.chnVols[nChn] > (int)(param & 0x0F)) param = memory.chnVols[nChn] - (param & 0x0F); + if (memory.chnVols[nChn] > (param & 0x0F)) param = memory.chnVols[nChn] - (param & 0x0F); else param = 0; } else if (param & 0x0F) @@ -643,6 +643,13 @@ } } + // IT Compatibility: Envelope pickup after SCx cut + // Test case: cut-carry.it + if(pChn->nInc == 0 && IsCompatibleMode(TRK_IMPULSETRACKER)) + { + bInstrumentChanged = true; + } + // XM compatibility: new instrument + portamento = ignore new instrument number, but reload old instrument settings (the world of XM is upside down...) // And this does *not* happen if volume column portamento is used together with note delay... (handled in ProcessEffects(), where all the other note delay stuff is.) // Test case: porta-delay.xm @@ -2421,7 +2428,7 @@ //-------------------------------------------------------------------------------------------------- { MODCHANNEL *pChn = &Chn[nChn]; - MidiPortamento(nChn, -param); //Send midi pitch bend event if there's a plugin + MidiPortamento(nChn, -(int)param); //Send midi pitch bend event if there's a plugin if(param) pChn->nOldPortaUpDown = param; @@ -3472,7 +3479,7 @@ if(oldcutoff < 0) oldcutoff = -oldcutoff; if((pChn->nVolume > 0) || (oldcutoff < 0x10) || (!(pChn->dwFlags & CHN_FILTER)) || (!(pChn->nLeftVol|pChn->nRightVol))) - SetupChannelFilter(pChn, (pChn->dwFlags & CHN_FILTER) ? false : true); + SetupChannelFilter(pChn, !(pChn->dwFlags & CHN_FILTER)); #endif // NO_FILTER return 4; @@ -3493,7 +3500,7 @@ } #ifndef NO_FILTER - SetupChannelFilter(pChn, (pChn->dwFlags & CHN_FILTER) ? false : true); + SetupChannelFilter(pChn, !(pChn->dwFlags & CHN_FILTER)); #endif // NO_FILTER return 4; @@ -3505,7 +3512,7 @@ { pChn->nFilterMode = (param >> 4); #ifndef NO_FILTER - SetupChannelFilter(pChn, (pChn->dwFlags & CHN_FILTER) ? false : true); + SetupChannelFilter(pChn, !(pChn->dwFlags & CHN_FILTER)); #endif // NO_FILTER } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |