|
From: <sag...@us...> - 2014-02-07 18:43:28
|
Revision: 3670
http://sourceforge.net/p/modplug/code/3670
Author: saga-games
Date: 2014-02-07 18:43:19 +0000 (Fri, 07 Feb 2014)
Log Message:
-----------
[Fix] IT compatibilty: Panbrello random waveform takes speed parameter into account now (test case: RandomWaveform.it)
Modified Paths:
--------------
trunk/OpenMPT/soundlib/ModChannel.h
trunk/OpenMPT/soundlib/Sndmix.cpp
Modified: trunk/OpenMPT/soundlib/ModChannel.h
===================================================================
--- trunk/OpenMPT/soundlib/ModChannel.h 2014-02-07 16:12:51 UTC (rev 3669)
+++ trunk/OpenMPT/soundlib/ModChannel.h 2014-02-07 18:43:19 UTC (rev 3670)
@@ -96,6 +96,7 @@
uint8 nVibratoType, nVibratoSpeed, nVibratoDepth;
uint8 nTremoloType, nTremoloSpeed, nTremoloDepth;
uint8 nPanbrelloType, nPanbrelloSpeed, nPanbrelloDepth;
+ int8 nPanbrelloRandomMemory;
uint8 nOldCmdEx, nOldVolParam, nOldTempo;
uint8 nOldOffset, nOldHiOffset;
uint8 nCutOff, nResonance;
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2014-02-07 16:12:51 UTC (rev 3669)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2014-02-07 18:43:19 UTC (rev 3670)
@@ -565,31 +565,35 @@
int CSoundFile::GetVibratoDelta(int type, int position) const
//-----------------------------------------------------------
{
- switch(type & 0x03)
+ // IT compatibility: IT has its own, more precise tables
+ if(IsCompatibleMode(TRK_IMPULSETRACKER))
{
- case 0:
- default:
- // IT compatibility: IT has its own, more precise tables
- return IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSinusTable[position] : ModSinusTable[position];
-
- case 1:
- // IT compatibility: IT has its own, more precise tables
- return IsCompatibleMode(TRK_IMPULSETRACKER) ? ITRampDownTable[position] : ModRampDownTable[position];
-
- case 2:
- // IT compatibility: IT has its own, more precise tables
- if(IsCompatibleMode(TRK_IMPULSETRACKER))
+ switch(type & 0x03)
+ {
+ case 0:
+ default:
+ return ITSinusTable[position];
+ case 1:
+ return ITRampDownTable[position];
+ case 2:
return position < 128 ? 64 : 0;
- else
+ case 3:
+ return (rand() & 0x7F) - 0x40;
+ }
+ } else
+ {
+ switch(type & 0x03)
+ {
+ case 0:
+ default:
+ return ModSinusTable[position];
+ case 1:
+ return ModRampDownTable[position];
+ case 2:
return position < 32 ? 127 : -127;
-
- case 3:
- //IT compatibility 19. Use random values
- if(IsCompatibleMode(TRK_IMPULSETRACKER))
- // TODO delay is not taken into account!
- return (rand() & 0x7F) - 0x40;
- else
+ case 3:
return ModRandomTable[position];
+ }
}
}
@@ -1070,7 +1074,7 @@
{
if(pChn->dwFlags[CHN_PANBRELLO])
{
- UINT panpos;
+ uint32 panpos;
// IT compatibility: IT has its own, more precise tables
if(IsCompatibleMode(TRK_IMPULSETRACKER))
panpos = pChn->nPanbrelloPos & 0xFF;
@@ -1079,7 +1083,22 @@
int pdelta = GetVibratoDelta(pChn->nPanbrelloType, panpos);
- pChn->nPanbrelloPos += pChn->nPanbrelloSpeed;
+ // IT compatibility: Sample-and-hold style random panbrello (tremolo and vibrato don't use this mechanism in IT)
+ // Test case: RandomWaveform.it
+ if(IsCompatibleMode(TRK_IMPULSETRACKER) && pChn->nPanbrelloType == 3)
+ {
+ if(pChn->nPanbrelloPos == 0 || pChn->nPanbrelloPos >= pChn->nPanbrelloSpeed)
+ {
+ pChn->nPanbrelloPos = 0;
+ pChn->nPanbrelloRandomMemory = static_cast<int8>(pdelta);
+ }
+ pChn->nPanbrelloPos++;
+ pdelta = pChn->nPanbrelloRandomMemory;
+ } else
+ {
+ pChn->nPanbrelloPos += pChn->nPanbrelloSpeed;
+ }
+
pdelta = ((pdelta * (int)pChn->nPanbrelloDepth) + 2) >> 3;
pdelta += pChn->nRealPan;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|