From: <sag...@us...> - 2013-07-21 12:51:30
|
Revision: 2545 http://sourceforge.net/p/modplug/code/2545 Author: saga-games Date: 2013-07-21 12:51:21 +0000 (Sun, 21 Jul 2013) Log Message: ----------- [Fix] In compatible and "old random variation" mode, pan swing was not applied if the same instrument also had a panning envelope. [Fix] Pitch / Pan separation wasn't applied if the channel was panned way to the left. [Mod] OpenMPT: Version is now 1.22.03.12 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2013-07-20 23:02:23 UTC (rev 2544) +++ trunk/OpenMPT/common/versionNumber.h 2013-07-21 12:51:21 UTC (rev 2545) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 03 -#define VER_MINORMINOR 11 +#define VER_MINORMINOR 12 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR)"."VER_STRINGIZE(VER_MAJOR)"."VER_STRINGIZE(VER_MINOR)"."VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2013-07-20 23:02:23 UTC (rev 2544) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2013-07-21 12:51:21 UTC (rev 2545) @@ -2236,7 +2236,7 @@ // Previously the values were just added up, so let's fix this! m.volcmd = VOLCMD_NONE; const uint16 param = static_cast<uint16>(m.param) + static_cast<uint16>(m.vol << 4); - m.param = static_cast<uint8>(std::min(param, uint16(0xFF))); + m.param = mpt::saturate_cast<uint8>(param); } } @@ -2303,10 +2303,13 @@ { bool instrPlugs = false; // Old pitch wheel commands were closest to sample pitch bend commands if the PWD is 13. - for(INSTRUMENTINDEX i = 1; i <= GetNumInstruments(); i++) if(Instruments[i] != nullptr && Instruments[i]->nMidiChannel != MidiNoChannel) + for(INSTRUMENTINDEX i = 1; i <= GetNumInstruments(); i++) { - Instruments[i]->midiPWD = 13; - instrPlugs = true; + if(Instruments[i] != nullptr && Instruments[i]->nMidiChannel != MidiNoChannel) + { + Instruments[i]->midiPWD = 13; + instrPlugs = true; + } } if(instrPlugs) { @@ -2314,5 +2317,21 @@ } } + if(m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 22, 03, 12) + && m_dwLastSavedWithVersion != MAKE_VERSION_NUMERIC(1, 22, 00, 00) + && (GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) + && (IsCompatibleMode(TRK_IMPULSETRACKER) || GetModFlag(MSF_OLDVOLSWING))) + { + // The "correct" pan swing implementation did nothing if the instrument also had a pan envelope. + // If there's a pan envelope, disable pan swing for such modules. + for(INSTRUMENTINDEX i = 1; i <= GetNumInstruments(); i++) + { + if(Instruments[i] != nullptr && Instruments[i]->nPanSwing != 0 && Instruments[i]->PanEnv.dwFlags[ENV_ENABLED]) + { + Instruments[i]->nPanSwing = 0; + } + } + } + Patterns.ForEachModCommand(UpgradePatternData(*this)); } \ No newline at end of file Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2013-07-20 23:02:23 UTC (rev 2544) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2013-07-21 12:51:21 UTC (rev 2545) @@ -939,7 +939,7 @@ // Get values in [-32, 32] const int envval = Util::Round<int>((pIns->PanEnv.GetValueFromPosition(envpos) - 0.5f) * 64.0f); - int pan = pChn->nPan; + int pan = pChn->nRealPan; if(pan >= 128) { pan += (envval * (256 - pan)) / 32; @@ -1160,7 +1160,7 @@ { const ModInstrument *pIns = pChn->pModInstrument; - if ((pIns->nPPS) && (pChn->nRealPan) && (pChn->nNote)) + if ((pIns->nPPS) && (pChn->nNote != NOTE_NONE)) { // PPS value is 1/512, i.e. PPS=1 will adjust by 8/512 = 1/64 for each 8 semitones // with PPS = 32 / PPC = C-5, E-6 will pan hard right (and D#6 will not) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |