From: Anton Baskanov baskanov@gmail.com
--- dlls/dmsynth/synth.c | 8 ++++++++ dlls/dmsynth/tests/dmsynth.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/dmsynth/synth.c b/dlls/dmsynth/synth.c index 0516b76af9c..9c5694740a9 100644 --- a/dlls/dmsynth/synth.c +++ b/dlls/dmsynth/synth.c @@ -46,6 +46,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmsynth);
#define CONN_TRANSFORM(src, ctrl, dst) (((src) & 0x3f) << 10) | (((ctrl) & 0x3f) << 4) | ((dst) & 0xf)
+#define CENTER_PAN_GAIN -30.10 + /* from src/rvoice/fluid_rvoice.h */ #define FLUID_LOOP_DURING_RELEASE 1 #define FLUID_LOOP_UNTIL_RELEASE 3 @@ -602,6 +604,8 @@ static HRESULT WINAPI synth_Open(IDirectMusicSynth8 *iface, DMUS_PORTPARAMS *par gain = 60.; /* compensate gain added in fluid_iir_filter_q_from_dB/fluid_iir_filter_set_q */ gain -= 15.05; + /* 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 +1943,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;