From: Anton Baskanov baskanov@gmail.com
--- dlls/dmsynth/synth.c | 7 +++++++ dlls/dmsynth/tests/dmsynth.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/dmsynth/synth.c b/dlls/dmsynth/synth.c index 5f4b005f5e6..0fe7a92a697 100644 --- a/dlls/dmsynth/synth.c +++ b/dlls/dmsynth/synth.c @@ -47,6 +47,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmsynth); #define CONN_TRANSFORM(src, ctrl, dst) (((src) & 0x3f) << 10) | (((ctrl) & 0x3f) << 4) | ((dst) & 0xf)
#define BASE_GAIN 60. +#define CENTER_PAN_GAIN -30.10
/* from src/rvoice/fluid_rvoice.h */ #define FLUID_LOOP_DURING_RELEASE 1 @@ -602,6 +603,8 @@ static HRESULT WINAPI synth_Open(IDirectMusicSynth8 *iface, DMUS_PORTPARAMS *par
/* native limits the total voice gain to 6 dB */ gain = BASE_GAIN; + /* compensate gain added in synth_preset_noteon */ + gain -= CENTER_PAN_GAIN; fluid_settings_setnum(This->fluid_settings, "synth.gain", pow(10., gain / 200.));
if (!(This->fluid_synth = new_fluid_synth(This->fluid_settings))) @@ -1939,6 +1942,10 @@ static int synth_preset_noteon(fluid_preset_t *fluid_preset, fluid_synth_t *flui add_voice_connections(fluid_voice, &articulation->list, articulation->connections); LIST_FOR_EACH_ENTRY(articulation, ®ion->articulations, struct articulation, entry) add_voice_connections(fluid_voice, &articulation->list, articulation->connections); + /* Unlike FluidSynth, native applies the gain limit after the panning. At + * least for the center pan we can replicate this by applying a panning + * attenuation here. */ + fluid_voice_gen_incr(voice->fluid_voice, GEN_ATTENUATION, -CENTER_PAN_GAIN); fluid_synth_start_voice(synth->fluid_synth, fluid_voice);
LeaveCriticalSection(&synth->cs); diff --git a/dlls/dmsynth/tests/dmsynth.c b/dlls/dmsynth/tests/dmsynth.c index 4ecaf5863e1..6293c1ea4bd 100644 --- a/dlls/dmsynth/tests/dmsynth.c +++ b/dlls/dmsynth/tests/dmsynth.c @@ -1787,7 +1787,7 @@ static void test_IKsControl(void) envelope.gain = 60.; envelope.channel_gain[0] = 0.; envelope.channel_gain[1] = 0.; - check_volume_envelope(synth, &default_instrument_download, &default_midi, &envelope, TRUE); + check_volume_envelope(synth, &default_instrument_download, &default_midi, &envelope, FALSE);
/* setting volume 0 changes voice gain */ volume = -600;