From: <sag...@us...> - 2011-09-28 21:04:30
|
Revision: 1064 http://modplug.svn.sourceforge.net/modplug/?rev=1064&view=rev Author: saga-games Date: 2011-09-28 21:04:23 +0000 (Wed, 28 Sep 2011) Log Message: ----------- [Ref] Moved some mod loading code around [Mod] Old Mod Flags (Emulate old volswing, Emulate VST instrument volume bug) are only set if they are potentitally needed [Fix] Volswing range was not updated for old ITP files [Mod] OpenMPT: Version is now 1.20.00.32 Modified Paths: -------------- trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_itp.cpp trunk/OpenMPT/soundlib/Load_xm.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-09-28 20:53:21 UTC (rev 1063) +++ trunk/OpenMPT/mptrack/version.h 2011-09-28 21:04:23 UTC (rev 1064) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 00 -#define VER_MINORMINOR 31 +#define VER_MINORMINOR 32 //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/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2011-09-28 20:53:21 UTC (rev 1063) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2011-09-28 21:04:23 UTC (rev 1064) @@ -1242,22 +1242,8 @@ } } - if(m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 17, 2, 50)) - { - SetModFlag(MSF_COMPATIBLE_PLAY, false); - SetModFlag(MSF_MIDICC_BUGEMULATION, true); - SetModFlag(MSF_OLDVOLSWING, true); - } + UpgradeModFlags(); - if(m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 20, 00, 00)) - { - // Previously, volume swing values ranged from 0 to 64. They should reach from 0 to 100 instead. - for(INSTRUMENTINDEX i = 1; i <= GetNumInstruments(); i++) if(Instruments[i] != nullptr) - { - Instruments[i]->nVolSwing = min(Instruments[i]->nVolSwing * 100 / 64, 100); - } - } - if(GetType() == MOD_TYPE_IT) { // Set appropriate mod flags if the file was not made with MPT. Modified: trunk/OpenMPT/soundlib/Load_itp.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_itp.cpp 2011-09-28 20:53:21 UTC (rev 1063) +++ trunk/OpenMPT/soundlib/Load_itp.cpp 2011-09-28 21:04:23 UTC (rev 1064) @@ -454,12 +454,7 @@ m_nMaxPeriod = 0xF000; m_nMinPeriod = 8; - if(m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 17, 2, 50)) - { - SetModFlag(MSF_COMPATIBLE_PLAY, false); - SetModFlag(MSF_MIDICC_BUGEMULATION, true); - SetModFlag(MSF_OLDVOLSWING, true); - } + UpgradeModFlags(); return true; } Modified: trunk/OpenMPT/soundlib/Load_xm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_xm.cpp 2011-09-28 20:53:21 UTC (rev 1063) +++ trunk/OpenMPT/soundlib/Load_xm.cpp 2011-09-28 21:04:23 UTC (rev 1064) @@ -712,8 +712,10 @@ LoadExtendedSongProperties(GetType(), ptr, lpStream, dwMemLength, &bInterpretOpenMPTMade); - if(bInterpretOpenMPTMade && m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 17, 2, 50)) - SetModFlag(MSF_MIDICC_BUGEMULATION, true); + if(bInterpretOpenMPTMade) + { + UpgradeModFlags(); + } if(bInterpretOpenMPTMade && m_dwLastSavedWithVersion == 0) m_dwLastSavedWithVersion = MAKE_VERSION_NUMERIC(1, 17, 01, 00); // early versions of OpenMPT had no version indication. Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2011-09-28 20:53:21 UTC (rev 1063) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2011-09-28 21:04:23 UTC (rev 1064) @@ -762,10 +762,10 @@ if ((m_nRestartPos >= Order.size()) || (Order[m_nRestartPos] >= Patterns.Size())) m_nRestartPos = 0; - // Fix old nasty broken (non-standard) MIDI configs in files. - if(m_dwLastSavedWithVersion && m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 20, 00, 00)) + // When reading a file made with an older version of MPT, it might be necessary to upgrade some settings automatically. + if(m_dwLastSavedWithVersion) { - FixMIDIConfigStrings(m_MidiCfg); + UpgradeSong(); } // plugin loader @@ -2901,6 +2901,53 @@ } +// For old files made with MPT that don't have m_dwSongFlags set yet, set the flags appropriately. +void CSoundFile::UpgradeModFlags() +//-------------------------------- +{ + if(m_dwLastSavedWithVersion && m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 17, 02, 50)) + { + SetModFlag(MSF_COMPATIBLE_PLAY, false); + SetModFlag(MSF_MIDICC_BUGEMULATION, false); + // If there are any plugins, enable volume bug emulation. + for(PLUGINDEX i = 0; i < MAX_MIXPLUGINS; i++) + { + if(m_MixPlugins[i].Info.dwPluginId1 | m_MixPlugins[i].Info.dwPluginId2) + { + SetModFlag(MSF_MIDICC_BUGEMULATION, true); + break; + } + } + // If there are any instruments with random variation, enable the old random variation behaviour. + for(INSTRUMENTINDEX i = 1; i <= GetNumInstruments(); i++) + { + if(Instruments[i] && (Instruments[i]->nVolSwing | Instruments[i]->nPanSwing | Instruments[i]->nCutSwing | Instruments[i]->nResSwing)) + { + SetModFlag(MSF_OLDVOLSWING, true); + break; + } + } + } +} + + +void CSoundFile::UpgradeSong() +//---------------------------- +{ + if(m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 20, 00, 00)) + { + // Previously, volume swing values ranged from 0 to 64. They should reach from 0 to 100 instead. + for(INSTRUMENTINDEX i = 1; i <= GetNumInstruments(); i++) if(Instruments[i] != nullptr) + { + Instruments[i]->nVolSwing = min(Instruments[i]->nVolSwing * 100 / 64, 100); + } + + // Fix old nasty broken (non-standard) MIDI configs in files. + FixMIDIConfigStrings(m_MidiCfg); + } +} + + // Fix old-format (not conforming to IT's MIDI macro definitions) MIDI config strings. void CSoundFile::FixMIDIConfigStrings(MODMIDICFG &midiCfg) //-------------------------------------------------------- Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2011-09-28 20:53:21 UTC (rev 1063) +++ trunk/OpenMPT/soundlib/Sndfile.h 2011-09-28 21:04:23 UTC (rev 1064) @@ -841,6 +841,8 @@ bool ReadJ2B(const LPCBYTE lpStream, const DWORD dwMemLength); bool ReadMID(const LPCBYTE lpStream, DWORD dwMemLength); + void UpgradeModFlags(); + void UpgradeSong(); static void FixMIDIConfigStrings(MODMIDICFG &midiCfg); // Save Functions This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |