From d1f3096cbb3d16eaa64eab77e2e230cd1ada82ec Mon Sep 17 00:00:00 2001 From: Johannes Schultz Date: Sat, 11 May 2024 21:04:10 +0000 Subject: [PATCH] Merged revision(s) 20702 from trunk/OpenMPT: [Mod] MDL: Command 9 is not Set Envelope Position, it select a different envelope instead. As we only have one envelope per type per instrument, instead do the only thing we can do for now: Assume that the instrument envelope was disabled and enable it. ........ git-svn-id: https://source.openmpt.org/svn/openmpt/branches/OpenMPT-1.30@20773 56274372-70c3-4bfc-bfc3-4c3a0b034d27 --- soundlib/Load_mdl.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/soundlib/Load_mdl.cpp b/soundlib/Load_mdl.cpp index 2437562019e..471a9f90594 100644 --- a/soundlib/Load_mdl.cpp +++ b/soundlib/Load_mdl.cpp @@ -168,7 +168,7 @@ static constexpr ModCommand::COMMAND MDLEffTrans[] = /* Either column */ /* 7 */ CMD_TEMPO, /* 8 */ CMD_PANNING8, - /* 9 */ CMD_SETENVPOSITION, + /* 9 */ CMD_S3MCMDEX, /* A */ CMD_NONE, /* B */ CMD_POSITIONJUMP, /* C */ CMD_GLOBALVOLUME, @@ -205,6 +205,16 @@ static void ConvertMDLCommand(uint8 &cmd, uint8 ¶m) case 0x08: // Panning param = (param & 0x7F) * 2u; break; + case 0x09: // Set Envelope (we can only have one envelope per type...) + if(param < 0x40) + param = 0x78; // Enable the one volume envelope we have + else if (param < 0x80) + param = 0x7A; // Enable the one panning envelope we have + else if(param < 0xC0) + param = 0x7C; // Enable the one pitch envelope we have + else + cmd = CMD_NONE; + break; case 0x0C: // Global volume param = (param + 1) / 2u; break;