|
From: <sag...@us...> - 2009-11-07 23:38:23
|
Revision: 416
http://modplug.svn.sourceforge.net/modplug/?rev=416&view=rev
Author: saga-games
Date: 2009-11-07 23:38:07 +0000 (Sat, 07 Nov 2009)
Log Message:
-----------
[Fix] A wrong #define was used in the plugin finding algorithm which broke plugin handling for instruments in some cases in the last revision.
[Fix] Various fixes to the MDL loader (taken from Schism Tracker)
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Load_mdl.cpp
trunk/OpenMPT/soundlib/Snd_defs.h
trunk/OpenMPT/soundlib/Snd_fx.cpp
Modified: trunk/OpenMPT/soundlib/Load_mdl.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_mdl.cpp 2009-11-07 21:40:01 UTC (rev 415)
+++ trunk/OpenMPT/soundlib/Load_mdl.cpp 2009-11-07 23:38:07 UTC (rev 416)
@@ -80,8 +80,30 @@
}
break;
case 0x0F: command = CMD_SPEED; break;
- case 0x10: if ((param & 0xF0) != 0xE0) { command = CMD_VOLUMESLIDE; if ((param & 0xF0) == 0xF0) param = ((param << 4) | 0x0F); else param >>= 2; } break;
- case 0x20: if ((param & 0xF0) != 0xE0) { command = CMD_VOLUMESLIDE; if ((param & 0xF0) != 0xF0) param >>= 2; } break;
+ case 0x10:
+ if ((param & 0xF0) != 0xE0) {
+ command = CMD_VOLUMESLIDE;
+ if ((param & 0xF0) == 0xF0) {
+ param = ((param << 4) | 0x0F);
+ } else {
+ param >>= 2;
+ if (param > 0xF)
+ param = 0xF;
+ param <<= 4;
+ }
+ }
+ break;
+ case 0x20:
+ if ((param & 0xF0) != 0xE0) {
+ command = CMD_VOLUMESLIDE;
+ if ((param & 0xF0) != 0xF0) {
+ param >>= 2;
+ if (param > 0xF)
+ param = 0xF;
+ }
+ }
+ break;
+
case 0x30: command = CMD_RETRIG; break;
case 0x40: command = CMD_TREMOLO; break;
case 0x50: command = CMD_TREMOR; break;
@@ -392,6 +414,10 @@
pIns->PanEnv.dwFlags |= ENV_ENABLED;
inspanenv[nins] = (ps[5] & 0x3F) + 1;
}
+
+ // taken from load_xm.cpp - seems to fix wakingup.mdl
+ if (!(pIns->VolEnv.dwFlags & ENV_ENABLED) && !pIns->nFadeOut)
+ pIns->nFadeOut = 8192;
}
}
dwPos += 34 + 14*lpStream[dwPos+1];
@@ -457,7 +483,6 @@
pSmp->nLoopStart = *((DWORD *)(p+4));
pSmp->nLoopEnd = pSmp->nLoopStart + *((DWORD *)(p+8));
if (pSmp->nLoopEnd > pSmp->nLoopStart) pSmp->uFlags |= CHN_LOOP;
- pSmp->nVolume = 256;
pSmp->nGlobalVol = 64;
if (p[13] & 0x01)
{
Modified: trunk/OpenMPT/soundlib/Snd_defs.h
===================================================================
--- trunk/OpenMPT/soundlib/Snd_defs.h 2009-11-07 21:40:01 UTC (rev 415)
+++ trunk/OpenMPT/soundlib/Snd_defs.h 2009-11-07 23:38:07 UTC (rev 416)
@@ -130,7 +130,7 @@
#define CHN_PINGPONGSUSTAIN 0x10
#define CHN_PANNING 0x20
#define CHN_STEREO 0x40
-#define CHN_PINGPONGFLAG 0x80 //When flag is on, bidiloop is processed backwards?
+#define CHN_PINGPONGFLAG 0x80 //When flag is on, sample is processed backwards
// Bits 8-31: Channel Flags
#define CHN_MUTE 0x100
#define CHN_KEYOFF 0x200
@@ -157,10 +157,10 @@
#define CHN_SYNCMUTE 0x40000000
// instrument envelope-specific flags
-#define ENV_LOOP 0x01 // env loop
-#define ENV_SUSTAIN 0x02 // env sustain
-#define ENV_CARRY 0x04 // env carry
-#define ENV_ENABLED 0x08 // env is enabled
+#define ENV_ENABLED 0x01 // env is enabled
+#define ENV_LOOP 0x02 // env loop
+#define ENV_SUSTAIN 0x04 // env sustain
+#define ENV_CARRY 0x08 // env carry
#define ENV_FILTER 0x10 // filter env enabled (this has to be combined with ENV_ENABLED in the pitch envelope's flags)
// instrument-specific flags
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-11-07 21:40:01 UTC (rev 415)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-11-07 23:38:07 UTC (rev 416)
@@ -3754,7 +3754,7 @@
UINT nPlugin=0;
if (pChn && pChn->pModInstrument) {
- if (respectMutes && pChn->pModSample && pChn->pModSample->uFlags&INS_MUTE) {
+ if (respectMutes && pChn->pModSample && (pChn->pModSample->uFlags & CHN_MUTE)) {
nPlugin = 0;
} else {
nPlugin = pChn->pModInstrument->nMixPlug;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|