Author: sagamusix
Date: Thu Jun 6 22:15:57 2024
New Revision: 20941
URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20941
Log:
[Imp] MED: Better translation of echo length.
Modified:
trunk/OpenMPT/soundlib/Load_med.cpp
Modified: trunk/OpenMPT/soundlib/Load_med.cpp
==============================================================================
--- trunk/OpenMPT/soundlib/Load_med.cpp Thu Jun 6 22:02:00 2024 (r20940)
+++ trunk/OpenMPT/soundlib/Load_med.cpp Thu Jun 6 22:15:57 2024 (r20941)
@@ -1353,6 +1353,7 @@
const float feedback = 1.0f / (1 << std::max(header.mixEchoDepth, uint8(1))); // The feedback we want
const float initialFeedback = std::sqrt(1.0f - (feedback * feedback)); // Actual strength of first delay's feedback
const float wetFactor = feedback / initialFeedback; // Factor to compensate for this
+ const float delay = (std::max(header.mixEchoLength.get(), uint16(1)) - 1) / 1999.0f;
SNDMIXPLUGIN &mixPlug = m_MixPlugins[numPlugins];
mpt::reconstruct(mixPlug);
memcpy(&mixPlug.Info.dwPluginId1, "OMXD", 4);
@@ -1366,8 +1367,8 @@
std::array<float32le, 6> params{};
params[1] = 1.0f; // WetDryMix
params[2] = feedback; // Feedback
- params[3] = header.mixEchoLength / 2000.0f; // LeftDelay
- params[4] = params[3]; // RightDelay
+ params[3] = delay; // LeftDelay
+ params[4] = delay; // RightDelay
params[5] = header.mixEchoType == 2 ? 1.0f : 0.0f; // PanDelay
mixPlug.pluginData.resize(sizeof(params));
memcpy(mixPlug.pluginData.data(), params.data(), sizeof(params));
|