From: <sv...@op...> - 2024-07-20 14:22:28
|
Author: sagamusix Date: Sat Jul 20 16:22:15 2024 New Revision: 21204 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21204 Log: [Fix] MED: Don't apply panning table to MMD2 files that don't have the freepan flag set (https://www.un4seen.com/forum/?topic=15448.msg143276#msg143276). [Fix] MED: Don't halve volume command parameters for pre-MMD3 files (https://www.un4seen.com/forum/?topic=15448.msg143276#msg143276). Modified: trunk/OpenMPT/soundlib/Load_med.cpp Modified: trunk/OpenMPT/soundlib/Load_med.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_med.cpp Fri Jul 19 12:42:56 2024 (r21203) +++ trunk/OpenMPT/soundlib/Load_med.cpp Sat Jul 20 16:22:15 2024 (r21204) @@ -442,9 +442,11 @@ if(param > 0 && param <= 20) m.SetEffectCommand(CMD_SPEED, param); break; - case 0x0C: // Set Volume + case 0x0C: // Set Volume (note: parameters >= 0x80 (only in hex mode?) should set the default instrument volume, which we don't support) if(!ctx.volHex && param < 0x99) m.SetEffectCommand(CMD_VOLUME, static_cast<ModCommand::PARAM>((param >> 4) * 10 + (param & 0x0F))); + else if(ctx.volHex && ctx.version < 3) + m.SetEffectCommand(CMD_VOLUME, static_cast<ModCommand::PARAM>(std::min(param & 0x7F, 64))); else if(ctx.volHex) m.SetEffectCommand(CMD_VOLUME, static_cast<ModCommand::PARAM>(((param & 0x7F) + 1) / 2)); break; @@ -1334,7 +1336,7 @@ ChnSettings[chn].nVolume = std::min<uint8>(file.ReadUint8(), 64); } } - if(header.trackPanOffset && file.Seek(header.trackPanOffset)) + if((freePan || version > 2) && header.trackPanOffset && file.Seek(header.trackPanOffset)) { for(CHANNELINDEX chn = 0; chn < GetNumChannels(); chn++) { @@ -1364,11 +1366,11 @@ mixPlug.Info.szLibraryName = "Echo"; std::array<float32le, 6> params{}; - params[1] = 1.0f; // WetDryMix - params[2] = feedback; // Feedback - params[3] = delay; // LeftDelay - params[4] = delay; // RightDelay - params[5] = header.mixEchoType == 2 ? 1.0f : 0.0f; // PanDelay + params[1] = 1.0f; // WetDryMix + params[2] = feedback; // Feedback + params[3] = delay; // LeftDelay + params[4] = delay; // RightDelay + params[5] = header.mixEchoType - 1.0f; // PanDelay mixPlug.pluginData.resize(sizeof(params)); memcpy(mixPlug.pluginData.data(), params.data(), sizeof(params)); } |