|
From: <sag...@us...> - 2014-11-07 00:46:51
|
Revision: 4556
http://sourceforge.net/p/modplug/code/4556
Author: saga-games
Date: 2014-11-07 00:46:39 +0000 (Fri, 07 Nov 2014)
Log Message:
-----------
[Fix] XM compatiblity: Make arpeggio behave even more like in FT2 by properly rounding the base note after portamento (test case: ArpSlide.xm)
[Fix] Glissando should only affect tone portamento, not portamento up / down effects. Further more, in ProTracker 1/2 mode, it is only applied on rows with portamento effects.
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Snd_flt.cpp
trunk/OpenMPT/soundlib/Snd_fx.cpp
trunk/OpenMPT/soundlib/Sndmix.cpp
trunk/OpenMPT/soundlib/modcommand.h
Modified: trunk/OpenMPT/soundlib/Snd_flt.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_flt.cpp 2014-11-06 20:48:55 UTC (rev 4555)
+++ trunk/OpenMPT/soundlib/Snd_flt.cpp 2014-11-07 00:46:39 UTC (rev 4556)
@@ -69,7 +69,7 @@
// Filtering is only ever done in IT if either cutoff is not full or if resonance is set.
if(IsCompatibleMode(TRK_IMPULSETRACKER) && resonance == 0 && computedCutoff >= 254)
{
- if(pChn->rowCommand.IsNote() && !pChn->dwFlags[CHN_PORTAMENTO] && !pChn->nMasterChn && m_SongFlags[SONG_FIRSTTICK])
+ if(pChn->rowCommand.IsNote() && !pChn->rowCommand.IsPortamento() && !pChn->nMasterChn && m_SongFlags[SONG_FIRSTTICK])
{
// Z7F next to a note disables the filter, however in other cases this should not happen.
// Test cases: filter-reset.it, filter-reset-carry.it, filter-nna.it
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-11-06 20:48:55 UTC (rev 4555)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-11-07 00:46:39 UTC (rev 4556)
@@ -145,7 +145,7 @@
{
const ModCommand &m = *Patterns[seekPat].GetpModCommand(target.pos.row, i);
if(m.note == NOTE_NOTECUT || m.note == NOTE_KEYOFF || (m.note == NOTE_FADE && GetNumInstruments())
- || (m.IsNote() && m.command != CMD_TONEPORTAMENTO && m.command != CMD_TONEPORTAVOL && m.volcmd != VOLCMD_TONEPORTAMENTO))
+ || (m.IsNote() && !m.IsPortamento()))
{
adjustSampleChn[i] = false;
}
@@ -1835,7 +1835,7 @@
UINT vol = pChn->rowCommand.vol;
UINT cmd = pChn->rowCommand.command;
UINT param = pChn->rowCommand.param;
- bool bPorta = (cmd == CMD_TONEPORTAMENTO) || (cmd == CMD_TONEPORTAVOL) || (volcmd == VOLCMD_TONEPORTAMENTO);
+ bool bPorta = pChn->rowCommand.IsPortamento();
UINT nStartTick = 0;
pChn->isFirstTick = (m_PlayState.m_nTickCount == 0);
@@ -4943,6 +4943,11 @@
//---------------------------------------------------------------------------------
{
if (!period) return 0;
+ if(IsCompatibleMode(TRK_FASTTRACKER2))
+ {
+ // FT2's "RelocateTon" function actually rounds up and down, while GetNoteFromPeriod normally just truncates.
+ nFineTune += 64;
+ }
// This essentially implements std::lower_bound, with the difference that we don't need an iterable container.
uint32 minNote = NOTE_MIN, maxNote = NOTE_MAX, count = maxNote - minNote + 1;
const bool periodIsFreq = m_SongFlags[SONG_LINEARSLIDES] && GetType() != MOD_TYPE_XM;
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2014-11-06 20:48:55 UTC (rev 4555)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2014-11-07 00:46:39 UTC (rev 4556)
@@ -133,25 +133,19 @@
static void ApplyStereoSeparation(mixsample_t *mixBuf, CSoundFile::samplecount_t count, int32 separation)
//-------------------------------------------------------------------------------------------------------
{
-#ifdef MPT_INTMIXER
- const mixsample_t fac1 = 64 + separation / 2, fac2 = 64 - separation / 2;
+ const mixsample_t fac1 = static_cast<mixsample_t>(64 + separation / 2), fac2 = static_cast<mixsample_t>(64 - separation / 2);
for(CSoundFile::samplecount_t i = 0; i < count; i++)
{
- mixsample_t l = mixBuf[0], r = mixBuf[1];
+ const mixsample_t l = mixBuf[0], r = mixBuf[1];
+#ifdef MPT_INTMIXER
mixBuf[0] = static_cast<mixsample_t>((Util::mul32to64(l, fac1) + Util::mul32to64(r, fac2)) >> 7);
mixBuf[1] = static_cast<mixsample_t>((Util::mul32to64(l, fac2) + Util::mul32to64(r, fac1)) >> 7);
- mixBuf += 2;
- }
#else
- const mixsample_t fac1 = static_cast<mixsample_t>(64 + separation / 2), fac2 = static_cast<mixsample_t>(64 - separation / 2);
- for(CSoundFile::samplecount_t i = 0; i < count; i++)
- {
- mixsample_t l = mixBuf[0], r = mixBuf[1];
mixBuf[0] = (l * fac1 + r * fac2) / mixsample_t(128);
mixBuf[1] = (l * fac2 + r * fac1) / mixsample_t(128);
+#endif
mixBuf += 2;
}
-#endif
}
@@ -539,7 +533,7 @@
pChn->rightVol = pChn->newRightVol;
pChn->leftVol = pChn->newLeftVol;
- pChn->dwFlags.reset(CHN_PORTAMENTO | CHN_VIBRATO | CHN_TREMOLO | CHN_PANBRELLO);
+ pChn->dwFlags.reset(CHN_VIBRATO | CHN_TREMOLO | CHN_PANBRELLO);
pChn->nCommand = CMD_NONE;
pChn->m_plugParamValueStep = 0;
}
@@ -1211,15 +1205,9 @@
{
switch(m_PlayState.m_nTickCount % 3)
{
- case 0:
- arpeggioSteps = 0;
- break;
- case 1:
- arpeggioSteps = pChn->nArpeggio >> 4; // >> 4 <-> division by 16. This gives the first number in the parameter.
- break;
- case 2:
- arpeggioSteps = pChn->nArpeggio & 0x0F; //Gives the latter number in the parameter.
- break;
+ case 0: arpeggioSteps = 0; break;
+ case 1: arpeggioSteps = pChn->nArpeggio >> 4; break;
+ case 2: arpeggioSteps = pChn->nArpeggio & 0x0F; break;
}
pChn->m_CalculateFreq = true;
pChn->m_ReCalculateFreqOnFirstTick = true;
@@ -1867,8 +1855,8 @@
period = pChn->nPeriod;
// When glissando mode is set to semitones, clamp to the next halftone.
- if((pChn->dwFlags[CHN_GLISSANDO] && IsCompatibleMode(TRK_ALLTRACKERS))
- || ((pChn->dwFlags & (CHN_GLISSANDO | CHN_PORTAMENTO)) == (CHN_GLISSANDO | CHN_PORTAMENTO) && !IsCompatibleMode(TRK_ALLTRACKERS)))
+ if((pChn->dwFlags & (CHN_GLISSANDO | CHN_PORTAMENTO)) == (CHN_GLISSANDO | CHN_PORTAMENTO)
+ && (!m_SongFlags[SONG_PT1XMODE] || (pChn->rowCommand.IsPortamento() && !m_SongFlags[SONG_FIRSTTICK])))
{
if(period != pChn->cachedPeriod)
{
Modified: trunk/OpenMPT/soundlib/modcommand.h
===================================================================
--- trunk/OpenMPT/soundlib/modcommand.h 2014-11-06 20:48:55 UTC (rev 4555)
+++ trunk/OpenMPT/soundlib/modcommand.h 2014-11-07 00:46:39 UTC (rev 4556)
@@ -174,6 +174,8 @@
// Returns true if and only if note is a valid musical note or the note entry is empty.
bool IsNoteOrEmpty() const { return note == NOTE_NONE || IsNote(); }
static bool IsNoteOrEmpty(NOTE note) { return note == NOTE_NONE || IsNote(note); }
+ // Returns true if any of the commands in this cell trigger a tone portamento.
+ bool IsPortamento() const { return command == CMD_TONEPORTAMENTO || command == CMD_TONEPORTAVOL || volcmd == VOLCMD_TONEPORTAMENTO; }
static EffectType GetEffectType(COMMAND cmd);
EffectType GetEffectType() const { return GetEffectType(command); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|