|
From: <sag...@us...> - 2012-07-03 15:56:49
|
Revision: 1315
http://modplug.svn.sourceforge.net/modplug/?rev=1315&view=rev
Author: saga-games
Date: 2012-07-03 15:56:38 +0000 (Tue, 03 Jul 2012)
Log Message:
-----------
[Fix] XM Compatibility: First try to fix XM tremor... not quite correct yet, but at least Tito's ICANFLY.XM plays correctly now.
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Snd_fx.cpp
trunk/OpenMPT/soundlib/Sndmix.cpp
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-07-01 17:50:45 UTC (rev 1314)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-07-03 15:56:38 UTC (rev 1315)
@@ -464,7 +464,7 @@
case CMD_GLOBALVOLSLIDE:
if(IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2))
{
- //IT compatibility 16. Global volume slide params are stored per channel (FT2/IT)
+ // IT compatibility 16. Global volume slide params are stored per channel (FT2/IT)
if (param) memory.oldGlbVolSlide[nChn] = param; else param = memory.oldGlbVolSlide[nChn];
} else
{
@@ -526,7 +526,7 @@
{
nNextOrder = nCurrentOrder + 1;
nNextRow = 0;
- if(IsCompatibleMode(TRK_FASTTRACKER2)) nNextRow = nNextPatStartRow; // FT2 E60 bug
+ if(IsCompatibleMode(TRK_FASTTRACKER2)) nNextRow = nNextPatStartRow; // FT2 E60 bug
nNextPatStartRow = 0;
}
@@ -561,7 +561,7 @@
m_bPositionChanged = true;
if(IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2))
{
- //IT compatibility 16. Global volume slide params are stored per channel (FT2/IT)
+ // IT compatibility 16. Global volume slide params are stored per channel (FT2/IT)
for(CHANNELINDEX n = 0; n < GetNumChannels(); n++)
{
Chn[n].nOldGlobalVolSlide = memory.oldGlbVolSlide[n];
@@ -767,7 +767,7 @@
{
if ((!bPorta) || (!(GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT))) || (m_dwSongFlags & SONG_ITCOMPATGXX)
|| (!pChn->nLength) || ((pChn->dwFlags & CHN_NOTEFADE) && (!pChn->nFadeOutVol))
- //IT compatibility tentative fix: Reset envelopes when instrument changes.
+ // IT compatibility tentative fix: Reset envelopes when instrument changes.
|| (IsCompatibleMode(TRK_IMPULSETRACKER) && instrumentChanged))
{
pChn->dwFlags |= CHN_FASTVOLRAMP;
@@ -950,7 +950,7 @@
pChn->nFadeOutVol = 0;
}
- //IT compatibility tentative fix: Clear channel note memory.
+ // IT compatibility tentative fix: Clear channel note memory.
if(IsCompatibleMode(TRK_IMPULSETRACKER))
{
pChn->nNote = pChn->nNewNote = NOTE_NONE;
@@ -1118,7 +1118,7 @@
pChn->dwFlags &= ~CHN_FILTER;
pChn->dwFlags |= CHN_FASTVOLRAMP;
- //IT compatibility 15. Retrigger will not be reset (Tremor doesn't store anything here, so we just don't reset this as well)
+ // IT compatibility 15. Retrigger will not be reset (Tremor doesn't store anything here, so we just don't reset this as well)
if(!IsCompatibleMode(TRK_IMPULSETRACKER))
{
// FT2 compatibility: FT2 also doesn't reset retrigger
@@ -1431,11 +1431,11 @@
ModChannel *p = &Chn[n];
// Copy Channel
*p = *pChn;
- p->dwFlags &= ~(CHN_VIBRATO|CHN_TREMOLO|CHN_PANBRELLO|CHN_MUTE|CHN_PORTAMENTO);
+ p->dwFlags &= ~(CHN_VIBRATO | CHN_TREMOLO | CHN_PANBRELLO | CHN_MUTE | CHN_PORTAMENTO);
//rewbs: Copy mute and FX status from master chan.
//I'd like to copy other flags too, but this would change playback behaviour.
- p->dwFlags |= (pChn->dwFlags & (CHN_MUTE|CHN_NOFX));
+ p->dwFlags |= (pChn->dwFlags & (CHN_MUTE | CHN_NOFX));
p->nMasterChn = nChn + 1;
p->nCommand = 0;
@@ -2181,17 +2181,17 @@
// IT compatibility 12. / 13. Tremor (using modified DUMB's Tremor logic here because of old effects - http://dumb.sf.net/)
if(IsCompatibleMode(TRK_IMPULSETRACKER))
{
- if (param && !(m_dwSongFlags & SONG_ITOLDEFFECTS))
+ if(param && !(m_dwSongFlags & SONG_ITOLDEFFECTS))
{
// Old effects have different length interpretation (+1 for both on and off)
- if (param & 0xf0) param -= 0x10;
- if (param & 0x0f) param -= 0x01;
+ if(param & 0xF0) param -= 0x10;
+ if(param & 0x0F) param -= 0x01;
}
- pChn->nTremorCount |= 128; // set on/off flag
- }
- else
+ pChn->nTremorCount |= 0x80; // set on/off flag
+ } else if(IsCompatibleMode(TRK_FASTTRACKER2))
{
// XM Tremor. Logic is being processed in sndmix.cpp
+ pChn->nTremorCount |= 0x80; // set on/off flag
}
pChn->nCommand = CMD_TREMOR;
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2012-07-01 17:50:45 UTC (rev 1314)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2012-07-03 15:56:38 UTC (rev 1315)
@@ -1014,25 +1014,57 @@
void CSoundFile::ProcessTremor(ModChannel *pChn, int &vol)
//--------------------------------------------------------
{
- if(pChn->nCommand == CMD_TREMOR)
+ if(IsCompatibleMode(TRK_FASTTRACKER2))
{
+ // Weird XM tremor. Not quite correct yet, but much better than non-compatible tremor.
+ if(pChn->nTremorCount & 0x80)
+ {
+ if(!(m_dwSongFlags & SONG_FIRSTTICK) && pChn->nCommand == CMD_TREMOR)
+ {
+ const uint8 onTime = (pChn->nTremorParam >> 4) + 1, totalTime = onTime + (pChn->nTremorParam & 0x0F) + 1;
+
+ if((pChn->nTremorCount & 0x3F) == totalTime)
+ {
+ // Reset tremor count after one full cycle
+ pChn->nTremorCount &= 0xC0;
+ }
+
+ if((pChn->nTremorCount & 0x3F) >= onTime)
+ {
+ // Volume Off
+ pChn->nTremorCount |= 0x40;
+ } else
+ {
+ // Volume On
+ pChn->nTremorCount &= ~0x40;
+ }
+
+ pChn->nTremorCount = (pChn->nTremorCount & 0xC0) | ((pChn->nTremorCount + 1) & 0x3F);
+ }
+
+ if((pChn->nTremorCount & 0xC0) == 0xC0)
+ {
+ vol = 0;
+ }
+ }
+ } else if(pChn->nCommand == CMD_TREMOR)
+ {
// IT compatibility 12. / 13.: Tremor
if(IsCompatibleMode(TRK_IMPULSETRACKER))
{
- if ((pChn->nTremorCount & 128) && pChn->nLength)
+ if((pChn->nTremorCount & 0x80) && pChn->nLength)
{
- if (pChn->nTremorCount == 128)
- pChn->nTremorCount = (pChn->nTremorParam >> 4) | 192;
- else if (pChn->nTremorCount == 192)
- pChn->nTremorCount = (pChn->nTremorParam & 0x0F) | 128;
+ if (pChn->nTremorCount == 0x80)
+ pChn->nTremorCount = (pChn->nTremorParam >> 4) | 0xC0;
+ else if (pChn->nTremorCount == 0xC0)
+ pChn->nTremorCount = (pChn->nTremorParam & 0x0F) | 0x80;
else
pChn->nTremorCount--;
}
- if ((pChn->nTremorCount & 192) == 128)
+ if((pChn->nTremorCount & 0xC0) == 0x80)
vol = 0;
- }
- else
+ } else
{
UINT ontime = pChn->nTremorParam >> 4;
UINT n = ontime + (pChn->nTremorParam & 0x0F); // Total tremor cycle time (On + Off)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|