From: <sag...@us...> - 2011-09-20 00:10:21
|
Revision: 1047 http://modplug.svn.sourceforge.net/modplug/?rev=1047&view=rev Author: saga-games Date: 2011-09-20 00:10:15 +0000 (Tue, 20 Sep 2011) Log Message: ----------- [Fix] IT Compatiblity: Random variation should now be more correct. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-09-19 23:31:30 UTC (rev 1046) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-09-20 00:10:15 UTC (rev 1047) @@ -962,12 +962,12 @@ // IT compatibility: MPT has a weird vol swing algorithm.... if(IsCompatibleMode(TRK_IMPULSETRACKER)) { - double d = 128 * (((double) rand()) / RAND_MAX) - 64; - pChn->nVolSwing = d * pIns->nVolSwing / 100.0; + double d = 2 * (((double) rand()) / RAND_MAX) - 1; + pChn->nVolSwing = std::floor(d * pChn->nInsVol * pIns->nVolSwing / 100.0); } else { int d = ((LONG)pIns->nVolSwing * (LONG)((rand() & 0xFF) - 0x7F)) / 128; - pChn->nVolSwing = (signed short)((d * pChn->nVolume + 1)/128); + pChn->nVolSwing = (signed short)((d * pChn->nVolume + 1) / 128); } } // Pan Swing @@ -977,7 +977,7 @@ if(IsCompatibleMode(TRK_IMPULSETRACKER)) { double d = 2 * (((double) rand()) / RAND_MAX) - 1; - pChn->nPanSwing = d * pIns->nPanSwing * 4; + pChn->nPanSwing = std::floor(d * pIns->nPanSwing * 4); } else { int d = ((LONG)pIns->nPanSwing * (LONG)((rand() & 0xFF) - 0x7F)) / 128; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |