dmime: Send DMUS_PMSGT_DIRTY messages from the performance.

This commit is contained in:
Rémi Bernon 2023-09-22 18:49:16 +02:00 committed by Alexandre Julliard
parent ac832b97ae
commit 664caf6ed7
2 changed files with 61 additions and 49 deletions

View file

@ -204,6 +204,27 @@ static BOOL PostMessageToProcessMsgThread(struct performance *This, UINT iMsg) {
return PostThreadMessageA(This->procThreadId, iMsg, 0, 0);
}
static HRESULT performance_send_dirty_pmsg(struct performance *This, MUSIC_TIME music_time)
{
IDirectMusicPerformance8 *performance = &This->IDirectMusicPerformance8_iface;
IDirectMusicGraph *graph = &This->IDirectMusicGraph_iface;
DMUS_PMSG *msg;
HRESULT hr;
if (FAILED(hr = IDirectMusicPerformance8_AllocPMsg(performance, sizeof(*msg), &msg)))
return hr;
msg->mtTime = music_time;
msg->dwFlags = DMUS_PMSGF_MUSICTIME | DMUS_PMSGF_TOOL_QUEUE;
msg->dwType = DMUS_PMSGT_DIRTY;
if (FAILED(hr = IDirectMusicGraph_StampPMsg(graph, msg))
|| FAILED(hr = IDirectMusicPerformance8_SendPMsg(performance, msg)))
IDirectMusicPerformance8_FreePMsg(performance, msg);
return hr;
}
static int pchannel_block_compare(const void *key, const struct wine_rb_entry *entry)
{
const struct pchannel_block *b = WINE_RB_ENTRY_VALUE(entry, const struct pchannel_block, entry);
@ -1082,20 +1103,32 @@ static HRESULT WINAPI performance_PlaySegmentEx(IDirectMusicPerformance8 *iface,
struct performance *This = impl_from_IDirectMusicPerformance8(iface);
IDirectMusicSegmentState *state;
IDirectMusicSegment *segment;
MUSIC_TIME length;
HRESULT hr;
FIXME("(%p, %p, %s, %p, %#lx, %I64d, %p, %p, %p): stub\n", This, source, debugstr_w(segment_name),
transition, segment_flags, start_time, segment_state, from, audio_path);
/* NOTE: The time is in music time unless the DMUS_SEGF_REFTIME flag is set. */
if (segment_flags) FIXME("flags %#lx not implemented\n", segment_flags);
if (start_time) FIXME("start_time %I64d not implemented\n", start_time);
if (FAILED(hr = IUnknown_QueryInterface(source, &IID_IDirectMusicSegment, (void **)&segment)))
return hr;
if (FAILED(hr = segment_state_create((IDirectMusicSegment *)segment, start_time, &state)))
if (FAILED(hr = segment_state_create(segment, start_time, &state)))
{
IDirectMusicSegment_Release(segment);
return hr;
}
if (segment_state)
hr = IDirectMusicSegment_GetLength(segment, &length);
if (SUCCEEDED(hr))
hr = performance_send_dirty_pmsg(This, start_time);
if (SUCCEEDED(hr))
hr = performance_send_dirty_pmsg(This, start_time + length);
if (SUCCEEDED(hr) && segment_state)
{
*segment_state = state;
IDirectMusicSegmentState_AddRef(state);

View file

@ -3079,22 +3079,16 @@ static void test_notification_pmsg(void)
ok(hr == S_OK, "got %#lx\n", hr);
ret = test_tool_wait_message(tool, 500, &msg);
todo_wine ok(!ret, "got %#lx\n", ret);
if (!ret)
{
ok(!ret, "got %#lx\n", ret);
ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %#lx\n", msg->dwType);
hr = IDirectMusicPerformance_FreePMsg(performance, msg);
ok(hr == S_OK, "got %#lx\n", hr);
}
ret = test_tool_wait_message(tool, 500, &msg);
todo_wine ok(!ret, "got %#lx\n", ret);
if (!ret)
{
ok(!ret, "got %#lx\n", ret);
ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %#lx\n", msg->dwType);
hr = IDirectMusicPerformance_FreePMsg(performance, msg);
todo_wine ok(hr == S_OK, "got %#lx\n", hr);
}
ok(hr == S_OK, "got %#lx\n", hr);
ret = test_tool_wait_message(tool, 100, &msg);
ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret);
@ -3114,22 +3108,22 @@ static void test_notification_pmsg(void)
ok(hr == S_OK, "got %#lx\n", hr);
ret = test_tool_wait_message(tool, 500, (DMUS_PMSG **)&notif);
todo_wine ok(!ret, "got %#lx\n", ret);
if (!ret)
ok(!ret, "got %#lx\n", ret);
if (notif->dwType == DMUS_PMSGT_NOTIFICATION)
{
check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_PERFORMANCE, DMUS_NOTIFICATION_MUSICSTARTED);
}
hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif);
ok(hr == S_OK, "got %#lx\n", hr);
}
ret = test_tool_wait_message(tool, 500, (DMUS_PMSG **)&notif);
todo_wine ok(!ret, "got %#lx\n", ret);
if (!ret)
ok(!ret, "got %#lx\n", ret);
if (notif->dwType == DMUS_PMSGT_NOTIFICATION)
{
check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGSTART);
}
hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif);
ok(hr == S_OK, "got %#lx\n", hr);
}
ret = test_tool_wait_message(tool, 500, &msg);
todo_wine ok(!ret, "got %#lx\n", ret);
@ -3251,13 +3245,13 @@ static void test_notification_pmsg(void)
ok(hr == S_OK, "got %#lx\n", hr);
ret = test_tool_wait_message(tool, 500, (DMUS_PMSG **)&notif);
todo_wine ok(!ret, "got %#lx\n", ret);
if (!ret)
ok(!ret, "got %#lx\n", ret);
if (notif->dwType == DMUS_PMSGT_NOTIFICATION)
{
check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGSTART);
}
hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif);
ok(hr == S_OK, "got %#lx\n", hr);
}
hr = IDirectMusicPerformance_CloseDown(performance);
ok(hr == S_OK, "got %#lx\n", hr);
@ -3333,22 +3327,16 @@ static void test_wave_pmsg(void)
ok(hr == S_OK, "got %#lx\n", hr);
ret = test_tool_wait_message(tool, 500, &msg);
todo_wine ok(!ret, "got %#lx\n", ret);
if (!ret)
{
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);
}
ret = test_tool_wait_message(tool, 500, &msg);
todo_wine ok(!ret, "got %#lx\n", ret);
if (!ret)
{
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);
}
ret = test_tool_wait_message(tool, 100, &msg);
ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret);
@ -3364,17 +3352,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 ok(!ret, "got %#lx\n", ret);
if (!ret)
{
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);
}
ret = test_tool_wait_message(tool, 500, (DMUS_PMSG **)&wave);
todo_wine ok(!ret, "got %#lx\n", ret);
if (!ret)
ok(!ret, "got %#lx\n", ret);
if (wave->dwType == DMUS_PMSGT_WAVE)
{
ok(wave->dwType == DMUS_PMSGT_WAVE, "got %p\n", wave);
ok(!!wave->punkUser, "got %p\n", wave->punkUser);
@ -3384,9 +3369,9 @@ static void test_wave_pmsg(void)
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 ok(!ret, "got %#lx\n", ret);
@ -3555,22 +3540,19 @@ static void test_sequence_track(void)
ok(hr == S_OK, "got %#lx\n", hr);
ret = test_tool_wait_message(tool, 500, &msg);
todo_wine ok(!ret, "got %#lx\n", ret);
if (!ret)
{
ok(!ret, "got %#lx\n", ret);
ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %#lx\n", msg->dwType);
hr = IDirectMusicPerformance_FreePMsg(performance, msg);
ok(hr == S_OK, "got %#lx\n", hr);
}
ret = test_tool_wait_message(tool, 500, (DMUS_PMSG **)&note);
todo_wine ok(!ret, "got %#lx\n", ret);
if (!ret)
ok(!ret, "got %#lx\n", ret);
if (note->dwType == DMUS_PMSGT_NOTE)
{
check_dmus_note_pmsg(note, 0, 0, 500, 60, 120);
}
hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)note);
ok(hr == S_OK, "got %#lx\n", hr);
}
ret = test_tool_wait_message(tool, 500, (DMUS_PMSG **)&note);
todo_wine ok(!ret, "got %#lx\n", ret);
@ -3821,22 +3803,19 @@ static void test_band_track_play(void)
ok(hr == S_OK, "got %#lx\n", hr);
ret = test_tool_wait_message(tool, 500, &msg);
todo_wine ok(!ret, "got %#lx\n", ret);
if (!ret)
{
ok(!ret, "got %#lx\n", ret);
ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %#lx\n", msg->dwType);
hr = IDirectMusicPerformance_FreePMsg(performance, msg);
ok(hr == S_OK, "got %#lx\n", hr);
}
ret = test_tool_wait_message(tool, 500, (DMUS_PMSG **)&patch);
todo_wine ok(!ret, "got %#lx\n", ret);
if (!ret)
ok(!ret, "got %#lx\n", ret);
if (patch->dwType == DMUS_PMSGT_PATCH)
{
check_dmus_patch_pmsg(patch, 0, 1, 0, 1);
}
hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)patch);
ok(hr == S_OK, "got %#lx\n", hr);
}
ret = test_tool_wait_message(tool, 500, (DMUS_PMSG **)&patch);
todo_wine ok(!ret, "got %#lx\n", ret);