|
From: <sag...@us...> - 2010-06-15 21:08:49
|
Revision: 625
http://modplug.svn.sourceforge.net/modplug/?rev=625&view=rev
Author: saga-games
Date: 2010-06-15 21:08:42 +0000 (Tue, 15 Jun 2010)
Log Message:
-----------
[Fix] XM Compatibility: Prevent notes to be stopped after a fadeout. This way, a portamento effect can pick up a faded instrument which is long enough. This occours for example in the bassline (channel 11) of jt_burn.xm. Not tested with many XMs yet, I hope this won't break anything else...
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 2010-06-15 18:40:15 UTC (rev 624)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-06-15 21:08:42 UTC (rev 625)
@@ -740,7 +740,7 @@
if(!bPorta && pSmp && IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nC5Speed = pSmp->nC5Speed;
// XM Compatibility: Ignore notes with portamento if there was no note playing.
- if(bPorta && (pChn->pCurrentSample == nullptr) && IsCompatibleMode(TRK_FASTTRACKER2))
+ if(bPorta && (pChn->nInc == 0) && IsCompatibleMode(TRK_FASTTRACKER2))
{
pChn->nPeriod = 0;
return;
@@ -3540,7 +3540,7 @@
//--------------------------------
{
MODCHANNEL *pChn = &Chn[nChn];
- BOOL bKeyOn = (pChn->dwFlags & CHN_KEYOFF) ? FALSE : TRUE;
+ const bool bKeyOn = (pChn->dwFlags & CHN_KEYOFF) ? false : true;
pChn->dwFlags |= CHN_KEYOFF;
//if ((!pChn->pModInstrument) || (!(pChn->dwFlags & CHN_VOLENV)))
if ((pChn->pModInstrument) && (!(pChn->dwFlags & CHN_VOLENV)))
@@ -3550,34 +3550,35 @@
if (!pChn->nLength) return;
if ((pChn->dwFlags & CHN_SUSTAINLOOP) && (pChn->pModSample) && (bKeyOn))
{
- MODSAMPLE *psmp = pChn->pModSample;
- if (psmp->uFlags & CHN_LOOP)
+ const MODSAMPLE *pSmp = pChn->pModSample;
+ if (pSmp->uFlags & CHN_LOOP)
{
- if (psmp->uFlags & CHN_PINGPONGLOOP)
+ if (pSmp->uFlags & CHN_PINGPONGLOOP)
pChn->dwFlags |= CHN_PINGPONGLOOP;
else
pChn->dwFlags &= ~(CHN_PINGPONGLOOP|CHN_PINGPONGFLAG);
pChn->dwFlags |= CHN_LOOP;
- pChn->nLength = psmp->nLength;
- pChn->nLoopStart = psmp->nLoopStart;
- pChn->nLoopEnd = psmp->nLoopEnd;
+ pChn->nLength = pSmp->nLength;
+ pChn->nLoopStart = pSmp->nLoopStart;
+ pChn->nLoopEnd = pSmp->nLoopEnd;
if (pChn->nLength > pChn->nLoopEnd) pChn->nLength = pChn->nLoopEnd;
} else
{
pChn->dwFlags &= ~(CHN_LOOP|CHN_PINGPONGLOOP|CHN_PINGPONGFLAG);
- pChn->nLength = psmp->nLength;
+ pChn->nLength = pSmp->nLength;
}
}
if (pChn->pModInstrument)
{
MODINSTRUMENT *pIns = pChn->pModInstrument;
- if (((pIns->VolEnv.dwFlags & ENV_LOOP) || (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2))) && (pIns->nFadeOut)) {
+ if (((pIns->VolEnv.dwFlags & ENV_LOOP) || (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2))) && (pIns->nFadeOut))
+ {
pChn->dwFlags |= CHN_NOTEFADE;
}
- if (pIns->VolEnv.nReleaseNode != ENV_RELEASE_NODE_UNSET) {
- pChn->nVolEnvValueAtReleaseJump=getVolEnvValueFromPosition(pChn->nVolEnvPosition, pIns);
- pChn->nVolEnvPosition= pIns->VolEnv.Ticks[pIns->VolEnv.nReleaseNode];
+ if (pIns->VolEnv.nReleaseNode != ENV_RELEASE_NODE_UNSET)
+ {
+ pChn->nVolEnvValueAtReleaseJump = getVolEnvValueFromPosition(pChn->nVolEnvPosition, pIns); pChn->nVolEnvPosition= pIns->VolEnv.Ticks[pIns->VolEnv.nReleaseNode];
}
}
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2010-06-15 18:40:15 UTC (rev 624)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2010-06-15 21:08:42 UTC (rev 625)
@@ -930,7 +930,10 @@
MODINSTRUMENT *pIns = pChn->pModInstrument;
- if ((pChn->dwFlags & CHN_NOTEFADE) && (!(pChn->nFadeOutVol|pChn->nRightVol|pChn->nLeftVol)))
+ // XM Compatibility: Prevent notes to be stopped after a fadeout. This way, a portamento effect can pick up a faded instrument which is long enough.
+ // This occours for example in the bassline (channel 11) of jt_burn.xm. I hope this won't break anything else...
+ // I also suppose this could decrease mixing performance a bit, but hey, which CPU can't handle 32 muted channels these days... :-)
+ if ((pChn->dwFlags & CHN_NOTEFADE) && (!(pChn->nFadeOutVol|pChn->nRightVol|pChn->nLeftVol)) && (!IsCompatibleMode(TRK_FASTTRACKER2)))
{
pChn->nLength = 0;
pChn->nROfs = pChn->nLOfs = 0;
@@ -1672,7 +1675,7 @@
// Volume Sustain ?
if ((pIns->VolEnv.dwFlags & ENV_SUSTAIN) && (!(pChn->dwFlags & CHN_KEYOFF)))
{
- if (pChn->nVolEnvPosition == (UINT)pIns->VolEnv.Ticks[pIns->VolEnv.nSustainEnd]+1)
+ if (pChn->nVolEnvPosition == (UINT)pIns->VolEnv.Ticks[pIns->VolEnv.nSustainEnd] + 1)
pChn->nVolEnvPosition = pIns->VolEnv.Ticks[pIns->VolEnv.nSustainStart];
} else
// End of Envelope ?
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|