|
From: <sag...@us...> - 2010-10-22 14:25:36
|
Revision: 746
http://modplug.svn.sourceforge.net/modplug/?rev=746&view=rev
Author: saga-games
Date: 2010-10-22 14:25:30 +0000 (Fri, 22 Oct 2010)
Log Message:
-----------
[Fix] XM Loader: Fixed handling of instruments with no samples, so that instruments assigned to VST plugins work correctly.
[Imp] PTM Loader: Improved handling of the note cut effect a bit.
[Ref] J2B Loader: Replaced some numbers by their #defined macros
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Load_ptm.cpp
trunk/OpenMPT/soundlib/Load_xm.cpp
trunk/OpenMPT/soundlib/load_j2b.cpp
Modified: trunk/OpenMPT/soundlib/Load_ptm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_ptm.cpp 2010-10-22 14:24:48 UTC (rev 745)
+++ trunk/OpenMPT/soundlib/Load_ptm.cpp 2010-10-22 14:25:30 UTC (rev 746)
@@ -177,6 +177,15 @@
{
ConvertModCommand(&m[nChn]);
MODExx2S3MSxx(&m[nChn]);
+ // Note cut does just mute the sample, not cut it. We have to fix that, if possible.
+ if(m[nChn].command == CMD_S3MCMDEX && (m[nChn].param & 0xF0) == 0xC0 && m[nChn].volcmd == VOLCMD_NONE)
+ {
+ // SCx => v00 + SDx
+ // This is a pretty dumb solution because many (?) PTM files make usage of the volume column + note cut at the same time.
+ m[nChn].param = 0xD0 | (m[nChn].param & 0x0F);
+ m[nChn].volcmd = VOLCMD_VOLUME;
+ m[nChn].vol = 0;
+ }
} else
{
switch(m[nChn].command)
Modified: trunk/OpenMPT/soundlib/Load_xm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_xm.cpp 2010-10-22 14:24:48 UTC (rev 745)
+++ trunk/OpenMPT/soundlib/Load_xm.cpp 2010-10-22 14:25:30 UTC (rev 746)
@@ -327,6 +327,8 @@
memcpy(Instruments[iIns]->name, pih.name, 22);
SpaceToNullStringFixed(Instruments[iIns]->name, 22);
+ memset(&xmsh, 0, sizeof(XMSAMPLEHEADER));
+
if ((nsamples = pih.samples) > 0)
{
/* we have samples, so let's read the rest of this instrument
@@ -336,7 +338,6 @@
if (dwMemPos + ihsize >= dwMemLength)
return true;
- memset(&xmsh, 0, sizeof(XMSAMPLEHEADER));
memcpy(&xmsh,
lpStream + dwMemPos + sizeof(XMINSTRUMENTHEADER),
min(ihsize - sizeof(XMINSTRUMENTHEADER), sizeof(XMSAMPLEHEADER)));
@@ -355,15 +356,11 @@
if(xmsh.midichannel != 0 || xmsh.midienabled != 0 || xmsh.midiprogram != 0 || xmsh.mutecomputer != 0 || xmsh.pitchwheelrange != 0)
bIsFT2 = true; // definitely not MPT. (or any other tracker)
- dwMemPos += LittleEndian(pih.size);
- } else
- {
- if (LittleEndian(pih.size))
- dwMemPos += LittleEndian(pih.size);
- else
- dwMemPos += sizeof(XMINSTRUMENTHEADER);
- continue;
}
+ if (LittleEndian(pih.size))
+ dwMemPos += LittleEndian(pih.size);
+ else
+ dwMemPos += sizeof(XMINSTRUMENTHEADER);
memset(samplemap, 0, sizeof(samplemap));
if (nsamples > 32) return true;
Modified: trunk/OpenMPT/soundlib/load_j2b.cpp
===================================================================
--- trunk/OpenMPT/soundlib/load_j2b.cpp 2010-10-22 14:24:48 UTC (rev 745)
+++ trunk/OpenMPT/soundlib/load_j2b.cpp 2010-10-22 14:25:30 UTC (rev 746)
@@ -478,7 +478,7 @@
{
case AMCHUNKID_MAIN: // "MAIN" - Song info (AMFF)
case AMCHUNKID_INIT: // "INIT" - Song info (AM)
- if((LittleEndian(chunkheader->signature) == 0x4E49414D && !bIsAM) || (LittleEndian(chunkheader->signature) == 0x54494E49 && bIsAM))
+ if((LittleEndian(chunkheader->signature) == AMCHUNKID_MAIN && !bIsAM) || (LittleEndian(chunkheader->signature) == AMCHUNKID_INIT && bIsAM))
{
ASSERT_CAN_READ_CHUNK(sizeof(AMFFCHUNK_MAIN));
AMFFCHUNK_MAIN *mainchunk = (AMFFCHUNK_MAIN *)(lpStream + dwMemPos);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|