This serie is the first result of investigation of loops not being played on dmusic for wave tracks. It basically: - extends tests so that we can check if loop work at some extend (they don't right now) - add and fix a couple of existing tests. And contain fixes for crufts in existing code: - fix an errouneous prototype - removed unused fields.
From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dmime/tests/dmime.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/dlls/dmime/tests/dmime.c b/dlls/dmime/tests/dmime.c index e9036511e9d..e22193e3a5c 100644 --- a/dlls/dmime/tests/dmime.c +++ b/dlls/dmime/tests/dmime.c @@ -4483,10 +4483,11 @@ static void test_segment_state(void) hr = IDirectMusicSegmentState_GetStartPoint(state, &time); ok(hr == S_OK, "got %#lx\n", hr); ok(time == 0, "got %#lx\n", time); - time = 0xdeadbeef; + value = 0xdeadbeef; hr = IDirectMusicSegmentState_GetRepeats(state, &value); ok(hr == S_OK, "got %#lx\n", hr); - ok(time == 0xdeadbeef, "got %#lx\n", time); + todo_wine + ok(value == 0, "got %#lx\n", value); time = 0xdeadbeef; hr = IDirectMusicSegmentState_GetStartTime(state, &time); ok(hr == S_OK, "got %#lx\n", hr); @@ -4566,10 +4567,11 @@ static void test_segment_state(void) hr = IDirectMusicSegmentState_GetStartPoint(state, &time); ok(hr == S_OK, "got %#lx\n", hr); ok(time == 50, "got %lu\n", time); - time = 0xdeadbeef; + value = 0xdeadbeef; hr = IDirectMusicSegmentState_GetRepeats(state, &value); ok(hr == S_OK, "got %#lx\n", hr); - ok(time == 0xdeadbeef, "got %#lx\n", time); + todo_wine + ok(value == 0, "got %#lx\n", value); time = 0xdeadbeef; hr = IDirectMusicSegmentState_GetStartTime(state, &time); ok(hr == S_OK, "got %#lx\n", hr); @@ -4596,10 +4598,11 @@ static void test_segment_state(void) hr = IDirectMusicSegmentState_GetStartPoint(state, &time); ok(hr == S_OK, "got %#lx\n", hr); ok(time == 50, "got %#lx\n", time); - time = 0xdeadbeef; + value = 0xdeadbeef; hr = IDirectMusicSegmentState_GetRepeats(state, &value); ok(hr == S_OK, "got %#lx\n", hr); - ok(time == 0xdeadbeef, "got %#lx\n", time); + todo_wine + ok(value == 0, "got %#lx\n", value); time = 0xdeadbeef; hr = IDirectMusicSegmentState_GetStartTime(state, &time); ok(hr == S_OK, "got %#lx\n", hr);
From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dmime/tests/dmime.c | 89 +++++++++++++++++++++++++++++++--------- 1 file changed, 70 insertions(+), 19 deletions(-)
diff --git a/dlls/dmime/tests/dmime.c b/dlls/dmime/tests/dmime.c index e22193e3a5c..f96e6509b7a 100644 --- a/dlls/dmime/tests/dmime.c +++ b/dlls/dmime/tests/dmime.c @@ -3542,7 +3542,7 @@ static void test_notification_pmsg(void) IDirectMusicTool_Release(tool); }
-static void test_wave_pmsg(void) +static void test_wave_pmsg(unsigned num_repeats) { static const DWORD message_types[] = { @@ -3550,17 +3550,25 @@ static void test_wave_pmsg(void) DMUS_PMSGT_WAVE, }; IDirectMusicPerformance *performance; + IDirectMusicSegmentState *state; IDirectMusicSegment *segment; IDirectMusicLoader8 *loader; IDirectMusicGraph *graph; WCHAR test_wav[MAX_PATH]; IDirectMusicTool *tool; DMUS_WAVE_PMSG *wave; + DWORD mt_start_ref; MUSIC_TIME length; DMUS_PMSG *msg; + DWORD value; HRESULT hr; + unsigned i; DWORD ret;
+ if (num_repeats) + winetest_push_context("with %u repeats", num_repeats); + else + winetest_push_context("without any repeats"); hr = test_tool_create(message_types, ARRAY_SIZE(message_types), &tool); ok(hr == S_OK, "got %#lx\n", hr);
@@ -3599,6 +3607,12 @@ static void test_wave_pmsg(void) ok(length == 1, "got %lu\n", length);
+ if (num_repeats) + { + hr = IDirectMusicSegment_SetRepeats(segment, num_repeats); + ok(hr == S_OK, "got %#lx\n", hr); + } + /* without Download, no DMUS_PMSGT_WAVE is sent */
hr = IDirectMusicPerformance_PlaySegment(performance, segment, 0, 0, NULL); @@ -3611,10 +3625,14 @@ static void test_wave_pmsg(void) ok(hr == S_OK, "got %#lx\n", hr);
ret = test_tool_wait_message(tool, 500, &msg); + todo_wine_if(num_repeats) ok(!ret, "got %#lx\n", ret); - ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %p\n", msg); - hr = IDirectMusicPerformance_FreePMsg(performance, msg); - ok(hr == S_OK, "got %#lx\n", hr); + if (!ret) + { + ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %p\n", msg); + hr = IDirectMusicPerformance_FreePMsg(performance, msg); + ok(hr == S_OK, "got %#lx\n", hr); + }
ret = test_tool_wait_message(tool, 100, &msg); ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret); @@ -3626,7 +3644,7 @@ static void test_wave_pmsg(void) hr = IDirectMusicSegment8_Download((IDirectMusicSegment8 *)segment, (IUnknown *)performance); ok(hr == S_OK, "got %#lx\n", hr);
- hr = IDirectMusicPerformance_PlaySegment(performance, segment, 0, 0, NULL); + hr = IDirectMusicPerformance_PlaySegment(performance, segment, 0, 0, &state); ok(hr == S_OK, "got %#lx\n", hr);
ret = test_tool_wait_message(tool, 500, &msg); @@ -3635,24 +3653,54 @@ static void test_wave_pmsg(void) hr = IDirectMusicPerformance_FreePMsg(performance, msg); ok(hr == S_OK, "got %#lx\n", hr);
- ret = test_tool_wait_message(tool, 500, (DMUS_PMSG **)&wave); - ok(!ret, "got %#lx\n", ret); - ok(wave->dwType == DMUS_PMSGT_WAVE, "got %p\n", wave); - ok(!!wave->punkUser, "got %p\n", wave->punkUser); - ok(wave->rtStartOffset == 0, "got %I64d\n", wave->rtStartOffset); - ok(wave->rtDuration == 1000000, "got %I64d\n", wave->rtDuration); - ok(wave->lOffset == 0, "got %lu\n", wave->lOffset); - ok(wave->lVolume == 0, "got %lu\n", wave->lVolume); - ok(wave->lPitch == 0, "got %lu\n", wave->lPitch); - ok(wave->bFlags == 0, "got %#x\n", wave->bFlags); - hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)wave); + hr = IDirectMusicPerformance_ReferenceToMusicTime(performance, 1000000, &length); ok(hr == S_OK, "got %#lx\n", hr); + /* assuming not modified tempo */ + length = round((1000000 * 120.0 * DMUS_PPQ) / 600000000.0); + + for (i = 0; i <= num_repeats; i++) + { + ret = test_tool_wait_message(tool, 500, (DMUS_PMSG **)&wave); + todo_wine_if(num_repeats && ret) + ok(!ret, "got %#lx\n", ret); + if (ret) continue; + ok(wave->dwType == DMUS_PMSGT_WAVE, "got %p\n", wave); + ok(wave->dwSize == sizeof(*wave), "got %lu\n", wave->dwSize); + ok(!!wave->punkUser, "got %p\n", wave->punkUser); + ok((wave->dwFlags & DMUS_PMSGF_REFTIME) && (wave->dwFlags & DMUS_PMSGF_MUSICTIME), + "got %lx\n", wave->dwFlags); + if (i == 0) + mt_start_ref = wave->mtTime; + else + todo_wine + ok(wave->mtTime == mt_start_ref + length * i, "got %lu (%lu,%lu)\n", wave->mtTime, mt_start_ref, i * length); + ok(wave->rtStartOffset == 0, "got %I64d\n", wave->rtStartOffset); + ok(wave->rtDuration == 1000000, "got %I64d\n", wave->rtDuration); + ok(wave->lOffset == 0, "got %lu\n", wave->lOffset); + ok(wave->lVolume == 0, "got %lu\n", wave->lVolume); + ok(wave->lPitch == 0, "got %lu\n", wave->lPitch); + ok(wave->bFlags == 0, "got %#x\n", wave->bFlags); + hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)wave); + ok(hr == S_OK, "got %#lx\n", hr); + }
ret = test_tool_wait_message(tool, 500, &msg); + todo_wine_if(num_repeats) ok(!ret, "got %#lx\n", ret); - ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %p\n", msg); - hr = IDirectMusicPerformance_FreePMsg(performance, msg); + if (!ret) + { + ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %p\n", msg); + hr = IDirectMusicPerformance_FreePMsg(performance, msg); + ok(hr == S_OK, "got %#lx\n", hr); + } + + hr = IDirectMusicSegment_GetRepeats(segment, &value); ok(hr == S_OK, "got %#lx\n", hr); + ok(value == num_repeats, "got %lu\n", value); + + hr = IDirectMusicSegmentState_GetRepeats(state, &value); + ok(hr == S_OK, "got %#lx\n", hr); + ok(value == num_repeats, "got %lu\n", value);
hr = IDirectMusicSegment8_Unload((IDirectMusicSegment8 *)segment, (IUnknown *)performance); ok(hr == S_OK, "got %#lx\n", hr); @@ -3670,6 +3718,8 @@ static void test_wave_pmsg(void)
IDirectMusicPerformance_Release(performance); IDirectMusicTool_Release(tool); + + winetest_pop_context(); }
static void test_sequence_track(void) @@ -4664,7 +4714,8 @@ START_TEST(dmime) test_performance_time(); test_performance_pmsg(); test_notification_pmsg(); - test_wave_pmsg(); + test_wave_pmsg(0); + test_wave_pmsg(10); test_sequence_track(); test_band_track_play(); test_tempo_track_play();
From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dmime/audiopath.c | 4 ++-- include/dmusici.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/dmime/audiopath.c b/dlls/dmime/audiopath.c index 2e6a916136f..3389f965b8f 100644 --- a/dlls/dmime/audiopath.c +++ b/dlls/dmime/audiopath.c @@ -140,12 +140,12 @@ static ULONG WINAPI IDirectMusicAudioPathImpl_Release (IDirectMusicAudioPath *if }
static HRESULT WINAPI IDirectMusicAudioPathImpl_GetObjectInPath (IDirectMusicAudioPath *iface, DWORD dwPChannel, DWORD dwStage, DWORD dwBuffer, - REFGUID guidObject, WORD dwIndex, REFGUID iidInterface, void** ppObject) + REFGUID guidObject, DWORD dwIndex, REFGUID iidInterface, void** ppObject) { struct IDirectMusicAudioPathImpl *This = impl_from_IDirectMusicAudioPath(iface); HRESULT hr;
- FIXME("(%p, %ld, %ld, %ld, %s, %d, %s, %p): stub\n", This, dwPChannel, dwStage, dwBuffer, debugstr_dmguid(guidObject), + FIXME("(%p, %ld, %ld, %ld, %s, %ld, %s, %p): stub\n", This, dwPChannel, dwStage, dwBuffer, debugstr_dmguid(guidObject), dwIndex, debugstr_dmguid(iidInterface), ppObject); switch (dwStage) { diff --git a/include/dmusici.h b/include/dmusici.h index 80e89a37d0e..bae6d2ae139 100644 --- a/include/dmusici.h +++ b/include/dmusici.h @@ -1177,7 +1177,7 @@ DECLARE_INTERFACE_(IDirectMusicAudioPath,IUnknown) STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** IDirectMusicAudioPath methods ***/ - STDMETHOD(GetObjectInPath)(THIS_ DWORD dwPChannel, DWORD dwStage, DWORD dwBuffer, REFGUID guidObject, WORD dwIndex, REFGUID iidInterface, void **ppObject) PURE; + STDMETHOD(GetObjectInPath)(THIS_ DWORD dwPChannel, DWORD dwStage, DWORD dwBuffer, REFGUID guidObject, DWORD dwIndex, REFGUID iidInterface, void **ppObject) PURE; STDMETHOD(Activate)(THIS_ BOOL fActivate) PURE; STDMETHOD(SetVolume)(THIS_ LONG lVolume, DWORD dwDuration) PURE; STDMETHOD(ConvertPChannel)(THIS_ DWORD dwPChannelIn, DWORD *pdwPChannelOut) PURE;
From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dmime/segment.c | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/dlls/dmime/segment.c b/dlls/dmime/segment.c index 75e8d706ed4..b208f89148c 100644 --- a/dlls/dmime/segment.c +++ b/dlls/dmime/segment.c @@ -49,10 +49,6 @@ struct segment DMUS_IO_SEGMENT_HEADER header; IDirectMusicGraph *pGraph; struct list tracks; - - PCMWAVEFORMAT wave_format; - void *wave_data; - int data_size; };
static struct segment *segment_create(void); @@ -112,7 +108,6 @@ static ULONG WINAPI segment_Release(IDirectMusicSegment8 *iface) list_remove(&entry->entry); track_entry_destroy(entry); } - free(This->wave_data); free(This); }
From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dmime/tests/dmime.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dlls/dmime/tests/dmime.c b/dlls/dmime/tests/dmime.c index f96e6509b7a..26fdf3ef2a5 100644 --- a/dlls/dmime/tests/dmime.c +++ b/dlls/dmime/tests/dmime.c @@ -4512,6 +4512,10 @@ static void test_segment_state(void) ok(hr == S_OK, "got %#lx\n", hr); hr = IDirectMusicSegment_SetRepeats(segment, 0); ok(hr == S_OK, "got %#lx\n", hr); + hr = IDirectMusicSegment_SetLoopPoints(segment, 10, 70); + ok(hr == S_OK, "got %#lx\n", hr); + hr = IDirectMusicSegment_SetLoopPoints(segment, 10, 101); + ok(hr == DMUS_E_OUT_OF_RANGE, "got %#lx\n", hr); hr = IDirectMusicSegment_SetLoopPoints(segment, 0, 0); ok(hr == S_OK, "got %#lx\n", hr);
Note about the pipeline failures: the same failures happen with MR!4949 as well (esp the NULL deref in mf tests). So they likely are not bound to this MR.
This merge request was approved by Michael Stefaniuc.
Unrelated test failures outside DMusic