From: Anton Baskanov baskanov@gmail.com
Fixes missing lower notes of some instruments (e.g. Acoustic Grand Piano). --- dlls/dmsynth/synth.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/dlls/dmsynth/synth.c b/dlls/dmsynth/synth.c index 3f1760fcb90..e03235563e3 100644 --- a/dlls/dmsynth/synth.c +++ b/dlls/dmsynth/synth.c @@ -1499,6 +1499,11 @@ static BOOL set_gen_from_connection(fluid_voice_t *fluid_voice, const CONNECTION
/* SF2 / FluidSynth use 0.1% as "Sustain Level" unit, DLS2 uses percent, meaning is also reversed */ if (gen == GEN_MODENVSUSTAIN || gen == GEN_VOLENVSUSTAIN) value = 1000 - conn->lScale * 10 / 65536.; + /* SF2 / FluidSynth use timecents per key number unit, DLS2 uses timecents + * per 128 key number units, value is also inverted. */ + else if (gen == GEN_KEYTOMODENVHOLD || gen == GEN_KEYTOMODENVDECAY + || gen == GEN_KEYTOVOLENVHOLD || gen == GEN_KEYTOVOLENVDECAY) + value = -conn->lScale / 128. / 65536.; /* FIXME: SF2 and FluidSynth use 1200 * log2(f / 8.176) for absolute freqs, * whereas DLS2 uses (1200 * log2(f / 440.) + 6900) * 65536. The values * are very close but not strictly identical and we may need a conversion. @@ -1587,6 +1592,11 @@ static void add_mod_from_connection(fluid_voice_t *fluid_voice, const CONNECTION
/* SF2 / FluidSynth use 0.1% as "Sustain Level" unit, DLS2 uses percent, meaning is also reversed */ if (gen == GEN_MODENVSUSTAIN || gen == GEN_VOLENVSUSTAIN) value = 1000 - conn->lScale * 10 / 65536.; + /* SF2 / FluidSynth use timecents per key number unit, DLS2 uses timecents + * per 128 key number units, value is also inverted. */ + else if (gen == GEN_KEYTOMODENVHOLD || gen == GEN_KEYTOMODENVDECAY + || gen == GEN_KEYTOVOLENVHOLD || gen == GEN_KEYTOVOLENVDECAY) + value = -conn->lScale / 128. / 65536.; /* FIXME: SF2 and FluidSynth use 1200 * log2(f / 8.176) for absolute freqs, * whereas DLS2 uses (1200 * log2(f / 440.) + 6900) * 65536. The values * are very close but not strictly identical and we may need a conversion.