[PATCH 0/3] MR10351: dmsynth: Restore pre-2.4.3 fluidsynth note-cut behavior.
Fixes: e4d0decebcfad87c9a39b300dbd8fb0aa32b3a94 -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10351
From: Anton Baskanov <baskanov@gmail.com> --- dlls/dmsynth/tests/dmsynth.c | 46 +++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/dlls/dmsynth/tests/dmsynth.c b/dlls/dmsynth/tests/dmsynth.c index 3df6f9caf68..21a755c0fc6 100644 --- a/dlls/dmsynth/tests/dmsynth.c +++ b/dlls/dmsynth/tests/dmsynth.c @@ -1691,7 +1691,6 @@ static const struct instrument_download default_instrument_download = { .RangeKey = {.usLow = 0, .usHigh = 127}, .RangeVelocity = {.usLow = 0, .usHigh = 127}, - .fusOptions = F_RGN_OPTION_SELFNONEXCLUSIVE, .WaveLink = {.ulChannel = 1, .ulTableIndex = 1}, .WSMP = {.cbSize = sizeof(WSMPL), .usUnityNote = 60, .fulOptions = F_WSMP_NO_TRUNCATION, .cSampleLoops = 1}, .WLOOP[0] = {.cbSize = sizeof(WLOOP), .ulType = WLOOP_TYPE_FORWARD, .ulLength = SINE_LENGTH}, @@ -3235,6 +3234,50 @@ static void test_instrument_selection(void) IDirectMusicSynth_Release(synth); } +static void test_polyphony(void) +{ + struct instrument_download download; + IDirectMusicSynth *synth; + struct envelope envelope; + struct midi midi; + HRESULT hr; + + hr = CoCreateInstance(&CLSID_DirectMusicSynth, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicSynth, (void **)&synth); + ok(hr == S_OK, "got hr %#lx.\n", hr); + + /* on the drum channel, note-on causes an immediate shutdown of voices playing the same note */ + download = default_instrument_download; + download.instrument.ulPatch = F_INSTRUMENT_DRUMS; + download.connection_list.cConnections = 1; + download.connections[0].usDestination = CONN_DST_EG1_RELEASETIME; + download.connections[0].lScale = ABS_TIME_MS(1000); + memset(&midi, 0, sizeof(midi)); + midi.messages[0] = make_note_on(0, 9, 60, 127); + midi.messages[1] = make_note_on(0, 9, 60, 1); + envelope = default_volume_envelope; + envelope.gain = -969.; + check_volume_envelope(synth, &download, &midi, &envelope, TRUE); + + /* in mono mode, only one voice can play at a time */ + memset(&midi, 0, sizeof(midi)); + midi.messages[0] = make_cc(0, 0, 126, 0); + midi.messages[1] = make_note_on(0, 0, 60, 127); + midi.messages[2] = make_note_on(0, 0, 61, 1); + envelope = default_volume_envelope; + envelope.sustain.duration = 0.; + check_volume_envelope(synth, &default_instrument_download, &midi, &envelope, FALSE); + + /* enabling mono mode on one channel doesn't affect other channels */ + memset(&midi, 0, sizeof(midi)); + midi.messages[0] = make_cc(0, 0, 126, 0); + midi.messages[1] = make_note_on(0, 1, 60, 127); + midi.messages[2] = make_note_on(0, 1, 61, 1); + midi.messages[3] = make_note_off(10000000, 1, 60, 127); + check_volume_envelope(synth, &default_instrument_download, &midi, &default_volume_envelope, TRUE); + + IDirectMusicSynth_Release(synth); +} + static void test_IDirectMusicSynthSink(void) { IReferenceClock *latency_clock; @@ -3427,6 +3470,7 @@ START_TEST(dmsynth) test_IKsControl(); test_dls(); test_instrument_selection(); + test_polyphony(); test_IDirectMusicSynthSink(); CoUninitialize(); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10351
From: Anton Baskanov <baskanov@gmail.com> Fixes: e4d0decebcfad87c9a39b300dbd8fb0aa32b3a94 --- dlls/dmsynth/synth.c | 1 + dlls/dmsynth/tests/dmsynth.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/dmsynth/synth.c b/dlls/dmsynth/synth.c index ff862b62984..030f093bd54 100644 --- a/dlls/dmsynth/synth.c +++ b/dlls/dmsynth/synth.c @@ -604,6 +604,7 @@ static HRESULT WINAPI synth_Open(IDirectMusicSynth8 *iface, DMUS_PORTPARAMS *par !!(actual.dwEffectFlags & DMUS_EFFECT_REVERB)); fluid_settings_setint(This->fluid_settings, "synth.chorus.active", !!(actual.dwEffectFlags & DMUS_EFFECT_CHORUS)); + fluid_settings_setint(This->fluid_settings, "synth.note-cut", 1); /* native limits the total voice gain to 6 dB */ gain = BASE_GAIN; diff --git a/dlls/dmsynth/tests/dmsynth.c b/dlls/dmsynth/tests/dmsynth.c index 21a755c0fc6..868daeb0ec0 100644 --- a/dlls/dmsynth/tests/dmsynth.c +++ b/dlls/dmsynth/tests/dmsynth.c @@ -3256,7 +3256,7 @@ static void test_polyphony(void) midi.messages[1] = make_note_on(0, 9, 60, 1); envelope = default_volume_envelope; envelope.gain = -969.; - check_volume_envelope(synth, &download, &midi, &envelope, TRUE); + check_volume_envelope(synth, &download, &midi, &envelope, FALSE); /* in mono mode, only one voice can play at a time */ memset(&midi, 0, sizeof(midi)); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10351
From: Anton Baskanov <baskanov@gmail.com> --- dlls/dmsynth/synth.c | 2 ++ dlls/dmsynth/tests/dmsynth.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/dmsynth/synth.c b/dlls/dmsynth/synth.c index 030f093bd54..fc3560f2da1 100644 --- a/dlls/dmsynth/synth.c +++ b/dlls/dmsynth/synth.c @@ -466,9 +466,11 @@ static void synth_reset_default_values(struct synth *This) BYTE chan; fluid_synth_system_reset(This->fluid_synth); + fluid_synth_reset_basic_channel(This->fluid_synth, 0); for (chan = 0; chan < 0x10; chan++) { + fluid_synth_set_basic_channel(This->fluid_synth, chan, FLUID_CHANNEL_MODE_OMNION_POLY, 1); fluid_synth_program_select(This->fluid_synth, chan, fluid_sfont_get_id(This->fluid_sfont), 0, 0); fluid_synth_cc(This->fluid_synth, chan | 0xe0 /* PITCH_BEND */, 0, 0); diff --git a/dlls/dmsynth/tests/dmsynth.c b/dlls/dmsynth/tests/dmsynth.c index 868daeb0ec0..0ad8de93492 100644 --- a/dlls/dmsynth/tests/dmsynth.c +++ b/dlls/dmsynth/tests/dmsynth.c @@ -3273,7 +3273,7 @@ static void test_polyphony(void) midi.messages[1] = make_note_on(0, 1, 60, 127); midi.messages[2] = make_note_on(0, 1, 61, 1); midi.messages[3] = make_note_off(10000000, 1, 60, 127); - check_volume_envelope(synth, &default_instrument_download, &midi, &default_volume_envelope, TRUE); + check_volume_envelope(synth, &default_instrument_download, &midi, &default_volume_envelope, FALSE); IDirectMusicSynth_Release(synth); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10351
I'm traveling at the moment and don't have access to my desktop at home with my usual build and test environment. I'll be back on Saturday. The code though is small and well contained. So I'll sign off on it. But please wait on Rémi's approval too as this isn't my area of expertise. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10351#note_132627
This merge request was approved by Michael Stefaniuc. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10351
This merge request was approved by Rémi Bernon. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10351
participants (4)
-
Anton Baskanov -
Anton Baskanov (@baskanov) -
Michael Stefaniuc (@mstefani) -
Rémi Bernon