Fixing a couple of flaky tests, a missed change for MIDI time adjustment, as well fixing voice looping that causes notes to end too early.
-- v2: dmime: Force recompute MIDI message reference time. dmsynth: Set loop and sample generators on the fluid_voice. dmusic/tests: Skip test_default_gm_collection if gm.dls is missing. dmime/tests: Ignore failure on missing gm.dls in test_band_track_play. dmime/tests: Avoid checking message segment state reference count. dmime/tests: Remove flaky track playing state test.
From: Rémi Bernon rbernon@codeweavers.com
This fails regularly on Win7. --- dlls/dmime/tests/dmime.c | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/dlls/dmime/tests/dmime.c b/dlls/dmime/tests/dmime.c index 6dc9d8e0f5e..151dbead3c1 100644 --- a/dlls/dmime/tests/dmime.c +++ b/dlls/dmime/tests/dmime.c @@ -3971,11 +3971,6 @@ static void test_segment_state(void) ok(hr == S_OK, "got %#lx\n", hr);
- /* This might be timing dependent and if PlaySegment is already - * late, the tracks are played synchronously and right away. - */ - todo_wine check_track_state(track, playing, FALSE); - ret = test_track_wait_playing(track, 50); ok(ret == 0, "got %#lx\n", ret);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmime/tests/dmime.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/dmime/tests/dmime.c b/dlls/dmime/tests/dmime.c index 151dbead3c1..7ed6568ecd4 100644 --- a/dlls/dmime/tests/dmime.c +++ b/dlls/dmime/tests/dmime.c @@ -38,8 +38,8 @@ static ULONG get_refcount(void *iface) return IUnknown_Release(unknown); }
-#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) -static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) +#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c, FALSE) +static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported, BOOL check_refs) { ULONG expect_ref = get_refcount(iface_ptr); IUnknown *iface = iface_ptr; @@ -52,10 +52,10 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO if (SUCCEEDED(hr)) { LONG ref = get_refcount(unk); - ok_(__FILE__, line)(ref == expect_ref + 1, "got %ld\n", ref); + if (check_refs) ok_(__FILE__, line)(ref == expect_ref + 1, "got %ld\n", ref); IUnknown_Release(unk); ref = get_refcount(iface_ptr); - ok_(__FILE__, line)(ref == expect_ref, "got %ld\n", ref); + if (check_refs) ok_(__FILE__, line)(ref == expect_ref, "got %ld\n", ref); } }
@@ -3024,8 +3024,8 @@ static void check_dmus_notification_pmsg_(int line, DMUS_NOTIFICATION_PMSG *msg, ok_(__FILE__, line)(!msg->punkUser, "got punkUser %p\n", msg->punkUser); else { - check_interface_(line, msg->punkUser, &IID_IDirectMusicSegmentState, TRUE); - check_interface_(line, msg->punkUser, &IID_IDirectMusicSegmentState8, TRUE); + check_interface_(line, msg->punkUser, &IID_IDirectMusicSegmentState, TRUE, FALSE); + check_interface_(line, msg->punkUser, &IID_IDirectMusicSegmentState8, TRUE, FALSE); } }
From: Rémi Bernon rbernon@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55722 --- dlls/dmime/tests/dmime.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/dmime/tests/dmime.c b/dlls/dmime/tests/dmime.c index 7ed6568ecd4..85ea8fcfeff 100644 --- a/dlls/dmime/tests/dmime.c +++ b/dlls/dmime/tests/dmime.c @@ -3722,7 +3722,10 @@ static void test_band_track_play(void) &IID_IDirectMusicLoader8, (void **)&loader); ok(hr == S_OK, "got %#lx\n", hr); hr = IDirectMusicLoader_SetObject(loader, &desc); - ok(hr == S_OK, "got %#lx\n", hr); + if (hr == DMUS_E_LOADER_FAILEDOPEN) + skip("Failed to open gm.dls, missing system SoundFont?\n"); + else + ok(hr == S_OK, "got %#lx\n", hr);
hr = test_loader_stream_create(stream, loader, &loader_stream); ok(hr == S_OK, "got %#lx\n", hr);
From: Rémi Bernon rbernon@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55688 --- dlls/dmusic/tests/dmusic.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/dlls/dmusic/tests/dmusic.c b/dlls/dmusic/tests/dmusic.c index 51a6b0d8774..f71c0600366 100644 --- a/dlls/dmusic/tests/dmusic.c +++ b/dlls/dmusic/tests/dmusic.c @@ -1608,6 +1608,11 @@ static void test_default_gm_collection(void) ok(hr == S_OK, "got %#lx\n", hr);
hr = IDirectMusicLoader_GetObject(loader, &desc, &IID_IDirectMusicCollection, (void **)&collection); + if (hr == DMUS_E_LOADER_NOFILENAME) + { + skip("Failed to open default GM collection, skipping tests. Missing system SoundFont?\n"); + goto skip_tests; + } ok(hr == S_OK, "got %#lx\n", hr);
for (i = 0; hr == S_OK && i < ARRAY_SIZE(results); i++) @@ -1635,6 +1640,8 @@ static void test_default_gm_collection(void) }
IDirectMusicCollection_Release(collection); + +skip_tests: IDirectMusicLoader_Release(loader); }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmsynth/synth.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/dlls/dmsynth/synth.c b/dlls/dmsynth/synth.c index 2e9b6b48245..3e77a69bbc3 100644 --- a/dlls/dmsynth/synth.c +++ b/dlls/dmsynth/synth.c @@ -46,6 +46,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmsynth);
#define CONN_TRANSFORM(src, ctrl, dst) (((src) & 0x3f) << 10) | (((ctrl) & 0x3f) << 4) | ((dst) & 0xf)
+/* from src/rvoice/fluid_rvoice.h */ +#define FLUID_LOOP_DURING_RELEASE 1 +#define FLUID_LOOP_UNTIL_RELEASE 3 + static const char *debugstr_conn_src(UINT src) { switch (src) @@ -1747,11 +1751,6 @@ static int synth_preset_noteon(fluid_preset_t *fluid_preset, fluid_synth_t *flui
fluid_sample_set_sound_data(fluid_sample, wave->samples, NULL, wave->sample_count, wave->format.nSamplesPerSec, TRUE); - if (region->wave_sample.cSampleLoops) - { - WLOOP *loop = region->wave_loops; - fluid_sample_set_loop(fluid_sample, loop->ulStart, loop->ulStart + loop->ulLength); - } fluid_sample_set_pitch(fluid_sample, region->wave_sample.usUnityNote, region->wave_sample.sFineTune);
if (!(fluid_voice = fluid_synth_alloc_voice(synth->fluid_synth, fluid_sample, chan, key, vel))) @@ -1762,6 +1761,20 @@ static int synth_preset_noteon(fluid_preset_t *fluid_preset, fluid_synth_t *flui }
set_default_voice_connections(fluid_voice); + if (region->wave_sample.cSampleLoops) + { + WLOOP *loop = region->wave_loops; + + if (loop->ulType == WLOOP_TYPE_FORWARD) + fluid_voice_gen_set(fluid_voice, GEN_SAMPLEMODE, FLUID_LOOP_UNTIL_RELEASE); + else if (loop->ulType == WLOOP_TYPE_RELEASE) + fluid_voice_gen_set(fluid_voice, GEN_SAMPLEMODE, FLUID_LOOP_DURING_RELEASE); + else + FIXME("Unsupported loop type %lu\n", loop->ulType); + + fluid_voice_gen_set(fluid_voice, GEN_STARTLOOPADDROFS, loop->ulStart); + fluid_voice_gen_set(fluid_voice, GEN_ENDLOOPADDROFS, loop->ulStart + loop->ulLength); + } LIST_FOR_EACH_ENTRY(articulation, &instrument->articulations, struct articulation, entry) add_voice_connections(fluid_voice, &articulation->list, articulation->connections); LIST_FOR_EACH_ENTRY(articulation, ®ion->articulations, struct articulation, entry)
From: Rémi Bernon rbernon@codeweavers.com
Fixes 65e388137c6117aaf8f99cef808d32afa29c7639, which is otherwise no-op without this change. --- dlls/dmime/performance.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index a8fcd869331..cd057c71d80 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -1706,7 +1706,7 @@ static HRESULT WINAPI performance_tool_ProcessPMsg(IDirectMusicTool *iface, DMUS_NOTE_PMSG *note = (DMUS_NOTE_PMSG *)msg;
msg->mtTime += note->nOffset; - if (FAILED(hr = performance_send_midi_pmsg(This, msg, DMUS_PMSGF_REFTIME | DMUS_PMSGF_MUSICTIME | DMUS_PMSGF_TOOL_IMMEDIATE, + if (FAILED(hr = performance_send_midi_pmsg(This, msg, DMUS_PMSGF_MUSICTIME | DMUS_PMSGF_TOOL_IMMEDIATE, MIDI_NOTE_ON, note->bMidiValue, note->bVelocity))) WARN("Failed to translate message to MIDI, hr %#lx\n", hr);
v2: Use WLOOP_TYPE constants and loop->ulType to decide which FluidSynth loop type to use. Add one more flaky test fixup.
Anton Baskanov (@baskanov) commented about dlls/dmsynth/synth.c:
} set_default_voice_connections(fluid_voice);
if (region->wave_sample.cSampleLoops)
{
WLOOP *loop = region->wave_loops;
if (loop->ulType == WLOOP_TYPE_FORWARD)
fluid_voice_gen_set(fluid_voice, GEN_SAMPLEMODE, FLUID_LOOP_UNTIL_RELEASE);
I think it's the other way around. Evidence: on native Open Hi-hat, Chinese Cymbal, and Open Triangle from gm.dls continue to decay when released, while with this patch they end abruptly.
On Wed Oct 25 17:10:00 2023 +0000, Anton Baskanov wrote:
I think it's the other way around. Evidence: on native Open Hi-hat, Chinese Cymbal, and Open Triangle from gm.dls continue to decay when released, while with this patch they end abruptly.
Okay, thanks. Somehow it doesn't make any difference in my case with Final Fantasy VIII.