|
From: <sag...@us...> - 2013-07-27 19:21:58
|
Revision: 2546
http://sourceforge.net/p/modplug/code/2546
Author: saga-games
Date: 2013-07-27 19:21:51 +0000 (Sat, 27 Jul 2013)
Log Message:
-----------
[Fix] Sample editor: When applying sample normalization, the sample's global volume was also changed in formats that don't support global volume.
[Fix] XM compatibility: Finally got that FT2-style arpeggio to be balls-on!
Modified Paths:
--------------
trunk/OpenMPT/soundlib/SampleFormats.cpp
trunk/OpenMPT/soundlib/Sndmix.cpp
Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp
===================================================================
--- trunk/OpenMPT/soundlib/SampleFormats.cpp 2013-07-21 12:51:21 UTC (rev 2545)
+++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2013-07-27 19:21:51 UTC (rev 2546)
@@ -374,7 +374,6 @@
sample.nLength = wavFile.GetSampleLength();
sample.nC5Speed = wavFile.GetSampleRate();
wavFile.ApplySampleSettings(sample, m_szNames[nSample]);
- sample.Convert(MOD_TYPE_IT, GetType());
FileReader sampleChunk = wavFile.GetSampleData();
@@ -448,6 +447,8 @@
*wsmpChunk = wavFile.GetWsmpChunk();
}
+ sample.Convert(MOD_TYPE_IT, GetType());
+
return true;
}
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2013-07-21 12:51:21 UTC (rev 2545)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2013-07-27 19:21:51 UTC (rev 2546)
@@ -1267,25 +1267,29 @@
{
switch(tick % 3)
{
- case 1: period = Util::Round<int>(period / TwoToPowerXOver12(pChn->nArpeggio >> 4)); break;
- case 2: period = Util::Round<int>(period / TwoToPowerXOver12(pChn->nArpeggio & 0x0F)); break;
+ case 1: period = Util::Round<int>(period / TwoToPowerXOver12(pChn->nArpeggio >> 4)); break;
+ case 2: period = Util::Round<int>(period / TwoToPowerXOver12(pChn->nArpeggio & 0x0F)); break;
}
}
}
// FastTracker 2: Swedish tracker logic (TM) arpeggio
else if(IsCompatibleMode(TRK_FASTTRACKER2))
{
- BYTE note = pChn->nNote;
+ uint8 note = pChn->nNote;
int arpPos = 0;
if(!m_SongFlags[SONG_FIRSTTICK])
{
- arpPos = ((int)m_nMusicSpeed - (int)m_nTickCount) % 3;
- if((m_nMusicSpeed > 18) && (m_nMusicSpeed - m_nTickCount > 16)) arpPos = 2; // swedish tracker logic, I love it
+ arpPos = m_nMusicSpeed - (m_nTickCount % m_nMusicSpeed);
+ // The fact that arpeggio behaves in a totally fucked up way at 16 ticks/row or more is that the arpeggio offset LUT only has 16 entries in FT2.
+ // At more than 16 ticks/row, FT2 reads into the vibrato table, which is placed right after the arpeggio table.
+ if(arpPos > 16) arpPos = 2;
+ else if(arpPos == 16) arpPos = 0;
+ else arpPos %= 3;
switch(arpPos)
{
- case 1: note += (pChn->nArpeggio >> 4); break;
- case 2: note += (pChn->nArpeggio & 0x0F); break;
+ case 1: note += (pChn->nArpeggio >> 4); break;
+ case 2: note += (pChn->nArpeggio & 0x0F); break;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|