|
From: <sag...@us...> - 2015-05-29 23:41:26
|
Revision: 5209
http://sourceforge.net/p/modplug/code/5209
Author: saga-games
Date: 2015-05-29 23:41:20 +0000 (Fri, 29 May 2015)
Log Message:
-----------
[Fix] Panning commands were still applied when seeking even if PT1/2 mode was enabled.
[Mod] MOD Loader: Heuristically enable PT1/2 mode if 8xx commands seem likely to be used as sync markers rather than panning
[Mod] MOD Loader: Treat EXO8 modules to have paired patterns like FLT8 modules (I don't have any such files to test, and it probably doesn't even matter since they should contain synthesized samples which we don't support)
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Load_mod.cpp
trunk/OpenMPT/soundlib/Snd_fx.cpp
Modified: trunk/OpenMPT/soundlib/Load_mod.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_mod.cpp 2015-05-29 23:10:31 UTC (rev 5208)
+++ trunk/OpenMPT/soundlib/Load_mod.cpp 2015-05-29 23:41:20 UTC (rev 5209)
@@ -543,7 +543,7 @@
LimitMax(m_nChannels, MAX_BASECHANNELS);
// Startrekker 8 channel mod (needs special treatment, see below)
- const bool isFLT8 = IsMagic(magic, "FLT8");
+ const bool isFLT8 = IsMagic(magic, "FLT8") || IsMagic(magic, "EXO8");
// Only apply VBlank tests to M.K. (ProTracker) modules.
const bool isMdKd = IsMagic(magic, "M.K.");
@@ -626,7 +626,7 @@
m_nMaxPeriod = 3424 * 4;
// Prevent clipping based on number of channels... If all channels are playing at full volume, "256 / #channels"
// is the maximum possible sample pre-amp without getting distortion (Compatible mix levels given).
- // The more channels we have, the less likely it is that all of them are used at the same time, though, so clip at 32...
+ // The more channels we have, the less likely it is that all of them are used at the same time, though, so cap at 32...
m_nSamplePreAmp = std::max(32, 256 / m_nChannels);
m_SongFlags.reset();
@@ -635,6 +635,7 @@
const CHANNELINDEX readChannels = (isFLT8 ? 4 : m_nChannels); // 4 channels per pattern in FLT8 format.
if(isFLT8) numPatterns++; // as one logical pattern consists of two real patterns in FLT8 format, the highest pattern number has to be increased by one.
+ uint8 maxPanning = 0; // For detecting 8xx-as-sync
bool hasTempoCommands = false; // for detecting VBlank MODs
bool leftPanning = false, extendedPanning = false; // for detecting 800-880 panning
bool onlyAmigaNotes = true;
@@ -689,15 +690,19 @@
// Perform some checks for our heuristics...
if(m.command == CMD_TEMPO && m.param < 100)
hasTempoCommands = true;
- if(m.command == CMD_PANNING8 && m.param < 0x80)
- leftPanning = true;
- if(m.command == CMD_PANNING8 && m.param > 0x8F && m.param != 0xA4)
- extendedPanning = true;
+ else if(m.command == CMD_PANNING8)
+ {
+ maxPanning = std::max(maxPanning, m.param);
+ if(m.param < 0x80)
+ leftPanning = true;
+ else if(m.param > 0x8F && m.param != 0xA4)
+ extendedPanning = true;
+ }
if(m.note == NOTE_NONE && m.instr > 0 && !isFLT8)
{
if(lastInstrument[chn] > 0 && lastInstrument[chn] != m.instr)
{
- // Arbitrary threshold for going into PT1x mode: 4 consecutive "sample swaps" in one pattern.
+ // Arbitrary threshold for going into PT1/2 mode: 4 consecutive "sample swaps" in one pattern.
if(++instrWithoutNoteCount[chn] >= 4)
{
m_SongFlags.set(SONG_PT1XMODE);
@@ -724,6 +729,11 @@
{
// M.K. files that don't exceed the Amiga note limit (fixes mod.mothergoose)
m_SongFlags.set(SONG_AMIGALIMITS);
+ // Arbitrary threshold for deciding that 8xx effects are only used as sync markers
+ if(maxPanning < 0x20)
+ {
+ m_SongFlags.set(SONG_PT1XMODE);
+ }
}
// Reading samples
@@ -758,7 +768,7 @@
m_SongFlags.set(SONG_VBLANK_TIMING);
if(GetLength(eNoAdjust, GetLengthTarget(songTime)).front().targetReached)
{
- // This just makes things worse, song is at least as long asi n CIA mode (e.g. in "Stary Hallway" by Neurodancer)
+ // This just makes things worse, song is at least as long as in CIA mode (e.g. in "Stary Hallway" by Neurodancer)
// Obviously we should keep using CIA timing then...
m_SongFlags.reset(SONG_VBLANK_TIMING);
} else
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-05-29 23:10:31 UTC (rev 5208)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-05-29 23:41:20 UTC (rev 5209)
@@ -2485,21 +2485,7 @@
} else
if (volcmd == VOLCMD_PANNING)
{
- // IT Compatibility (and other trackers as well): panning disables surround (unless panning in rear channels is enabled, which is not supported by the original trackers anyway)
- if(IsCompatibleMode(TRK_ALLTRACKERS) && !m_SongFlags[SONG_SURROUNDPAN])
- {
- pChn->dwFlags.reset(CHN_SURROUND);
- }
- if(vol > 64) vol = 64;
- pChn->nPan = vol * 4;
- pChn->dwFlags.set(CHN_FASTVOLRAMP);
- pChn->nRestorePanOnNewNote = 0;
- //IT compatibility 20. Set pan overrides random pan
- if(IsCompatibleMode(TRK_IMPULSETRACKER))
- {
- pChn->nPanSwing = 0;
- pChn->nPanbrelloOffset = 0;
- }
+ Panning(pChn, vol, Pan6bit);
}
#ifdef MODPLUG_TRACKER
@@ -2874,12 +2860,10 @@
// Set 8-bit Panning
case CMD_PANNING8:
- if(!m_SongFlags[SONG_FIRSTTICK]
- || m_SongFlags[SONG_PT1XMODE]) // No panning in ProTracker mode
+ if(m_SongFlags[SONG_FIRSTTICK])
{
- break;
+ Panning(pChn, param, Pan8bit);
}
- Panning(pChn, param, Pan8bit);
break;
// Panning Slide
@@ -3683,8 +3667,14 @@
void CSoundFile::Panning(ModChannel *pChn, uint32 param, PanningType panBits) const
//---------------------------------------------------------------------------------
{
- if (!m_SongFlags[SONG_SURROUNDPAN] && (panBits == 8 || IsCompatibleMode(TRK_ALLTRACKERS)))
+ // No panning in ProTracker mode
+ if(m_SongFlags[SONG_PT1XMODE])
{
+ return;
+ }
+ // IT Compatibility (and other trackers as well): panning disables surround (unless panning in rear channels is enabled, which is not supported by the original trackers anyway)
+ if (!m_SongFlags[SONG_SURROUNDPAN] && (panBits == Pan8bit || IsCompatibleMode(TRK_ALLTRACKERS)))
+ {
pChn->dwFlags.reset(CHN_SURROUND);
}
if(panBits == Pan4bit)
@@ -4011,7 +4001,7 @@
case 0x70: pChn->nTremoloType = param & 0x07; break;
// E8x: Set 4-bit Panning
case 0x80:
- if(m_SongFlags[SONG_FIRSTTICK] && !m_SongFlags[SONG_PT1XMODE])
+ if(m_SongFlags[SONG_FIRSTTICK])
{
Panning(pChn, param, Pan4bit);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|