|
From: <sag...@us...> - 2014-10-04 13:55:18
|
Revision: 4370
http://sourceforge.net/p/modplug/code/4370
Author: saga-games
Date: 2014-10-04 13:55:11 +0000 (Sat, 04 Oct 2014)
Log Message:
-----------
[Fix] Use normal compatible mix mode instead of FT2 panning mix mode for XM files that were compatibility-exported with OpenMPT 1.22 or older.
[Ref] Small readability changes in Snd_fx.cpp
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Snd_fx.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-10-04 13:50:53 UTC (rev 4369)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-10-04 13:55:11 UTC (rev 4370)
@@ -4952,10 +4952,10 @@
//-------------------------------------------------------------------------------
{
if (note == NOTE_NONE || (note >= NOTE_MIN_SPECIAL)) return 0;
+ note -= NOTE_MIN;
if (GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT|MOD_TYPE_MT2|MOD_TYPE_S3M|MOD_TYPE_STM|MOD_TYPE_MDL|MOD_TYPE_ULT|MOD_TYPE_WAV|MOD_TYPE_669
|MOD_TYPE_FAR|MOD_TYPE_DMF|MOD_TYPE_PTM|MOD_TYPE_AMS|MOD_TYPE_AMS2|MOD_TYPE_DBM|MOD_TYPE_AMF|MOD_TYPE_PSM|MOD_TYPE_J2B|MOD_TYPE_IMF))
{
- note -= NOTE_MIN;
if(m_SongFlags[SONG_LINEARSLIDES])
{
// In IT linear slide mode, periods are equal to frequency.
@@ -4964,14 +4964,14 @@
{
if (!nC5Speed) nC5Speed = 8363;
//(a*b)/c
- return Util::muldiv(8363, (FreqS3MTable[note % 12] << 5), nC5Speed << (note / 12));
+ return Util::muldiv_unsigned(8363, (FreqS3MTable[note % 12] << 5), nC5Speed << (note / 12));
//8363 * freq[note%12] / nC5Speed * 2^(5-note/12)
}
} else
if (GetType() == MOD_TYPE_XM)
{
- if (note < 13) note = 13;
- note -= 13;
+ if (note < 12) note = 12;
+ note -= 12;
// FT2 Compatibility: The lower three bits of the finetune are truncated.
// Test case: Finetune-Precision.xm
@@ -5010,7 +5010,6 @@
}
} else
{
- note--;
nFineTune = XM2MODFineTune(nFineTune);
if ((nFineTune) || (note < 36) || (note >= 36 + 6 * 12))
return (ProTrackerTunedPeriods[nFineTune * 12 + note % 12] << 5) >> (note / 12);
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2014-10-04 13:50:53 UTC (rev 4369)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2014-10-04 13:55:11 UTC (rev 4370)
@@ -625,8 +625,6 @@
MemsetZero(Instruments);
MemsetZero(m_szNames);
MemsetZero(m_MixPlugins);
- Order.Init();
- Patterns.ClearPatterns();
m_PlayState.m_lTotalSampleCount = 0;
m_PlayState.m_bPositionChanged = true;
@@ -2270,7 +2268,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 = mpt::saturate_cast<uint8>(param);
+ m.param = mpt::saturate_cast<ModCommand::PARAM>(param);
}
if(sndFile.m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 22, 07, 09)
@@ -2383,12 +2381,20 @@
}
}
- if(m_dwLastSavedWithVersion >= MAKE_VERSION_NUMERIC(1, 22, 07, 19)
- && m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 23, 01, 04)
- && GetType() == MOD_TYPE_XM
- && GetMixLevels() == mixLevels_compatible)
+ // Starting from OpenMPT 1.22.07.19, FT2-style panning was applied compatible mix mode.
+ // Starting from OpenMPT 1.23.01.04, FT2-style panning has its own mix mode instead.
+ if(GetType() == MOD_TYPE_XM)
{
- SetMixLevels(mixLevels_compatible_FT2);
+ if(m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 22, 07, 19)
+ && GetMixLevels() == mixLevels_compatible_FT2)
+ {
+ SetMixLevels(mixLevels_compatible);
+ } else if(m_dwLastSavedWithVersion >= MAKE_VERSION_NUMERIC(1, 22, 07, 19)
+ && m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 23, 01, 04)
+ && GetMixLevels() == mixLevels_compatible)
+ {
+ SetMixLevels(mixLevels_compatible_FT2);
+ }
}
Patterns.ForEachModCommand(UpgradePatternData(*this));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|