|
From: <sag...@us...> - 2015-03-04 02:08:40
|
Revision: 4818
http://sourceforge.net/p/modplug/code/4818
Author: saga-games
Date: 2015-03-04 02:08:26 +0000 (Wed, 04 Mar 2015)
Log Message:
-----------
[Imp] MOD Loader: Do not use VBlank timing if it actually results in a longer tune (http://bugs.openmpt.org/view.php?id=654)
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Load_mod.cpp
trunk/OpenMPT/soundlib/Snd_defs.h
trunk/OpenMPT/soundlib/Snd_fx.cpp
trunk/OpenMPT/soundlib/mod_specifications.cpp
Modified: trunk/OpenMPT/soundlib/Load_mod.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_mod.cpp 2015-03-03 22:41:35 UTC (rev 4817)
+++ trunk/OpenMPT/soundlib/Load_mod.cpp 2015-03-04 02:08:26 UTC (rev 4818)
@@ -338,23 +338,13 @@
// Functor for fixing VBlank MODs and MODs with 7-bit panning
-struct FixMODPatterns
+struct Fix7BitPanning
//===================
{
- FixMODPatterns(bool fixVBlank, bool fixPanning)
- {
- this->fixVBlank = fixVBlank;
- this->fixPanning = fixPanning;
- }
-
void operator()(ModCommand &m)
{
- if(m.command == CMD_TEMPO && this->fixVBlank)
+ if(m.command == CMD_PANNING8)
{
- // Fix VBlank MODs
- m.command = CMD_SPEED;
- } else if(m.command == CMD_PANNING8 && this->fixPanning)
- {
// Fix MODs with 7-bit + surround panning
if(m.param == 0xA4)
{
@@ -366,8 +356,6 @@
}
}
}
-
- bool fixVBlank, fixPanning;
};
@@ -762,12 +750,27 @@
// In the pattern loader above, a second condition is used: Only tempo commands
// below 100 BPM are taken into account. Furthermore, only M.K. (ProTracker)
// modules are checked.
- const bool fixVBlank = isMdKd && hasTempoCommands && GetSongTime() >= 600.0;
- const bool fix7BitPanning = leftPanning && !extendedPanning;
- if(fixVBlank || fix7BitPanning)
+ if(isMdKd && hasTempoCommands)
{
- Patterns.ForEachModCommand(FixMODPatterns(fixVBlank, fix7BitPanning));
+ const double songTime = GetSongTime();
+ if(songTime >= 600.0)
+ {
+ 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)
+ // Obviously we should keep using CIA timing then...
+ m_SongFlags.reset(SONG_VBLANK_TIMING);
+ } else
+ {
+ madeWithTracker = "ProTracker (VBlank)";
+ }
+ }
}
+ if(leftPanning && !extendedPanning)
+ {
+ Patterns.ForEachModCommand(Fix7BitPanning());
+ }
return true;
}
Modified: trunk/OpenMPT/soundlib/Snd_defs.h
===================================================================
--- trunk/OpenMPT/soundlib/Snd_defs.h 2015-03-03 22:41:35 UTC (rev 4817)
+++ trunk/OpenMPT/soundlib/Snd_defs.h 2015-03-04 02:08:26 UTC (rev 4818)
@@ -40,7 +40,6 @@
typedef uintptr_t SmpLength;
-#define MOD_AMIGAC2 0x1AB // Period of Amiga middle-c
const SmpLength MAX_SAMPLE_LENGTH = 0x10000000; // Sample length in *samples*
// Note: Sample size in bytes can be more than this (= 256 MB).
@@ -53,8 +52,8 @@
const SEQUENCEINDEX MAX_SEQUENCES = 50;
-const CHANNELINDEX MAX_BASECHANNELS = 127; // Max pattern channels.
-const CHANNELINDEX MAX_CHANNELS = 256; //200 // Maximum number of mixing channels.
+const CHANNELINDEX MAX_BASECHANNELS = 127; // Maximum pattern channels.
+const CHANNELINDEX MAX_CHANNELS = 256; // Maximum number of mixing channels.
#define FREQ_FRACBITS 4 // Number of fractional bits in return value of CSoundFile::GetFreqFromPeriod()
@@ -276,10 +275,11 @@
SONG_POSJUMP = 0x100000, // Position jump encountered (internal flag, do not touch)
SONG_PT1XMODE = 0x200000, // ProTracker 1/2 playback mode
SONG_PLAYALLSONGS = 0x400000, // Play all subsongs consecutively (libopenmpt)
+ SONG_VBLANK_TIMING = 0x800000, // Use MOD VBlank timing (F21 and higher set speed instead of tempo)
};
DECLARE_FLAGSET(SongFlags)
-#define SONG_FILE_FLAGS (SONG_EMBEDMIDICFG|SONG_FASTVOLSLIDES|SONG_ITOLDEFFECTS|SONG_ITCOMPATGXX|SONG_LINEARSLIDES|SONG_EXFILTERRANGE|SONG_AMIGALIMITS|SONG_PT1XMODE)
+#define SONG_FILE_FLAGS (SONG_EMBEDMIDICFG|SONG_FASTVOLSLIDES|SONG_ITOLDEFFECTS|SONG_ITCOMPATGXX|SONG_LINEARSLIDES|SONG_EXFILTERRANGE|SONG_AMIGALIMITS|SONG_PT1XMODE|SONG_VBLANK_TIMING)
#define SONG_PLAY_FLAGS (~SONG_FILE_FLAGS)
// Global Options (Renderer)
@@ -362,14 +362,6 @@
PLUGIN_VOLUMEHANDLING_MAX,
};
-// filtermodes
-/*enum {
- INST_FILTERMODE_DEFAULT=0,
- INST_FILTERMODE_HIGHPASS,
- INST_FILTERMODE_LOWPASS,
- INST_NUMFILTERMODES
-};*/
-
enum MidiChannel
{
MidiNoChannel = 0,
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-03 22:41:35 UTC (rev 4817)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-04 02:08:26 UTC (rev 4818)
@@ -379,14 +379,19 @@
}
#endif // MODPLUG_TRACKER
if (!param) break;
- // Allow high speed values here for VBlank MODs. (Maybe it would be better to have a "VBlank MOD" flag somewhere? Is it worth the effort?)
- if ((param <= GetModSpecifications().speedMax) || GetType() == MOD_TYPE_MOD)
+ if (param <= GetModSpecifications().speedMax)
{
memory.state.m_nMusicSpeed = param;
}
break;
// Set Tempo
case CMD_TEMPO:
+ if(m_SongFlags[SONG_VBLANK_TIMING])
+ {
+ // ProTracker MODs with VBlank timing: All Fxx parameters set the tick count.
+ if(param != 0) memory.state.m_nMusicSpeed = param;
+ break;
+ }
if ((adjustMode & eAdjust) && (GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)))
{
if (param) pChn->nOldTempo = param; else param = pChn->nOldTempo;
@@ -2229,7 +2234,7 @@
if(retrigEnv) //Case: instrument with no note data.
{
//IT compatibility: Instrument with no note.
- if(IsCompatibleMode(TRK_IMPULSETRACKER))
+ if(IsCompatibleMode(TRK_IMPULSETRACKER) || GetType() == MOD_TYPE_PLM)
{
if(GetNumInstruments())
{
@@ -2586,28 +2591,34 @@
// Set Tempo
case CMD_TEMPO:
+ if(m_SongFlags[SONG_VBLANK_TIMING])
+ {
+ // ProTracker MODs with VBlank timing: All Fxx parameters set the tick count.
+ if(m_SongFlags[SONG_FIRSTTICK] && param != 0) SetSpeed(param);
+ break;
+ }
// -> CODE#0010
// -> DESC="add extended parameter mechanism to pattern effects"
- m = nullptr;
- if (m_PlayState.m_nRow < Patterns[m_PlayState.m_nPattern].GetNumRows()-1)
+ m = nullptr;
+ if (m_PlayState.m_nRow < Patterns[m_PlayState.m_nPattern].GetNumRows()-1)
+ {
+ m = Patterns[m_PlayState.m_nPattern].GetpModCommand(m_PlayState.m_nRow + 1, nChn);
+ }
+ if (m && m->command == CMD_XPARAM)
+ {
+ if ((GetType() & MOD_TYPE_XM))
{
- m = Patterns[m_PlayState.m_nPattern].GetpModCommand(m_PlayState.m_nRow + 1, nChn);
+ param -= 0x20; //with XM, 0x20 is the lowest tempo. Anything below changes ticks per row.
}
- if (m && m->command == CMD_XPARAM)
- {
- if ((GetType() & MOD_TYPE_XM))
- {
- param -= 0x20; //with XM, 0x20 is the lowest tempo. Anything below changes ticks per row.
- }
- param = (param << 8) + m->param;
- }
+ param = (param << 8) + m->param;
+ }
// -! NEW_FEATURE#0010
- if (GetType() & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT))
- {
- if (param) pChn->nOldTempo = param; else param = pChn->nOldTempo;
- }
- if (param > GetModSpecifications().tempoMax) param = GetModSpecifications().tempoMax; // rewbs.merge: added check to avoid hyperspaced tempo!
- SetTempo(param);
+ if (GetType() & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT))
+ {
+ if (param) pChn->nOldTempo = param; else param = pChn->nOldTempo;
+ }
+ if (param > GetModSpecifications().tempoMax) param = GetModSpecifications().tempoMax; // rewbs.merge: added check to avoid hyperspaced tempo!
+ SetTempo(param);
break;
// Set Offset
Modified: trunk/OpenMPT/soundlib/mod_specifications.cpp
===================================================================
--- trunk/OpenMPT/soundlib/mod_specifications.cpp 2015-03-03 22:41:35 UTC (rev 4817)
+++ trunk/OpenMPT/soundlib/mod_specifications.cpp 2015-03-04 02:08:26 UTC (rev 4818)
@@ -115,7 +115,7 @@
false, // Doesn't support plugins
false, // No custom pattern time signatures
false, // No pattern names
- SongFlag(0) | SONG_PT1XMODE | SONG_AMIGALIMITS, // Supported song flags
+ SongFlag(0) | SONG_PT1XMODE | SONG_AMIGALIMITS | SONG_VBLANK_TIMING, // Supported song flags
};
@@ -159,7 +159,7 @@
false, // Doesn't support plugins
false, // No custom pattern time signatures
false, // No pattern names
- SongFlag(0) | SONG_LINEARSLIDES, // Supported song flags
+ SongFlag(0) | SONG_LINEARSLIDES, // Supported song flags
};
// XM with MPT extensions
@@ -246,7 +246,7 @@
false, // Doesn't support plugins
false, // No custom pattern time signatures
false, // No pattern names
- SongFlag(0) | SONG_FASTVOLSLIDES | SONG_AMIGALIMITS, // Supported song flags
+ SongFlag(0) | SONG_FASTVOLSLIDES | SONG_AMIGALIMITS, // Supported song flags
};
// S3M with MPT extensions
@@ -290,7 +290,7 @@
false, // Doesn't support plugins
false, // No custom pattern time signatures
false, // No pattern names
- SongFlag(0) | SONG_FASTVOLSLIDES | SONG_AMIGALIMITS, // Supported song flags
+ SongFlag(0) | SONG_FASTVOLSLIDES | SONG_AMIGALIMITS, // Supported song flags
};
const CModSpecifications it =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|