From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmime/performance.c | 74 ++++++++++++++++++++++++++++++++++ dlls/dmime/tests/dmime.c | 22 ++++------ dlls/dmime/tests/performance.c | 2 +- 3 files changed, 83 insertions(+), 15 deletions(-)
diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index a185716761d..887d9a7bf16 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -37,6 +37,7 @@ struct pchannel_block { struct performance { IDirectMusicPerformance8 IDirectMusicPerformance8_iface; + IDirectMusicGraph IDirectMusicGraph_iface; LONG ref; IDirectMusic8 *dmusic; IDirectSound *dsound; @@ -254,6 +255,8 @@ static inline struct performance *impl_from_IDirectMusicPerformance8(IDirectMusi /* IDirectMusicPerformance8 IUnknown part: */ static HRESULT WINAPI performance_QueryInterface(IDirectMusicPerformance8 *iface, REFIID riid, void **ret_iface) { + struct performance *This = impl_from_IDirectMusicPerformance8(iface); + TRACE("(%p, %s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
if (IsEqualGUID(riid, &IID_IUnknown) @@ -266,6 +269,13 @@ static HRESULT WINAPI performance_QueryInterface(IDirectMusicPerformance8 *iface return S_OK; }
+ if (IsEqualGUID(riid, &IID_IDirectMusicGraph)) + { + *ret_iface = &This->IDirectMusicGraph_iface; + IDirectMusicGraph_AddRef(&This->IDirectMusicGraph_iface); + return S_OK; + } + *ret_iface = NULL; WARN("(%p, %s, %p): not found\n", iface, debugstr_dmguid(riid), ret_iface); return E_NOINTERFACE; @@ -1249,6 +1259,69 @@ static const IDirectMusicPerformance8Vtbl performance_vtbl = performance_GetParamEx, };
+static inline struct performance *impl_from_IDirectMusicGraph(IDirectMusicGraph *iface) +{ + return CONTAINING_RECORD(iface, struct performance, IDirectMusicGraph_iface); +} + +static HRESULT WINAPI performance_graph_QueryInterface(IDirectMusicGraph *iface, REFIID riid, void **ret_iface) +{ + struct performance *This = impl_from_IDirectMusicGraph(iface); + return IDirectMusicPerformance8_QueryInterface(&This->IDirectMusicPerformance8_iface, riid, ret_iface); +} + +static ULONG WINAPI performance_graph_AddRef(IDirectMusicGraph *iface) +{ + struct performance *This = impl_from_IDirectMusicGraph(iface); + return IDirectMusicPerformance8_AddRef(&This->IDirectMusicPerformance8_iface); +} + +static ULONG WINAPI performance_graph_Release(IDirectMusicGraph *iface) +{ + struct performance *This = impl_from_IDirectMusicGraph(iface); + return IDirectMusicPerformance8_Release(&This->IDirectMusicPerformance8_iface); +} + +static HRESULT WINAPI performance_graph_StampPMsg(IDirectMusicGraph *iface, DMUS_PMSG *msg) +{ + struct performance *This = impl_from_IDirectMusicGraph(iface); + FIXME("(%p, %p): stub\n", This, msg); + return E_NOTIMPL; +} + +static HRESULT WINAPI performance_graph_InsertTool(IDirectMusicGraph *iface, IDirectMusicTool *tool, + DWORD *channels, DWORD channels_count, LONG index) +{ + struct performance *This = impl_from_IDirectMusicGraph(iface); + FIXME("(%p, %p, %p, %lu, %ld): stub\n", This, tool, channels, channels_count, index); + return E_NOTIMPL; +} + +static HRESULT WINAPI performance_graph_GetTool(IDirectMusicGraph *iface, DWORD index, IDirectMusicTool **tool) +{ + struct performance *This = impl_from_IDirectMusicGraph(iface); + FIXME("(%p, %lu, %p): stub\n", This, index, tool); + return E_NOTIMPL; +} + +static HRESULT WINAPI performance_graph_RemoveTool(IDirectMusicGraph *iface, IDirectMusicTool *tool) +{ + struct performance *This = impl_from_IDirectMusicGraph(iface); + FIXME("(%p, %p): stub\n", This, tool); + return E_NOTIMPL; +} + +static const IDirectMusicGraphVtbl performance_graph_vtbl = +{ + performance_graph_QueryInterface, + performance_graph_AddRef, + performance_graph_Release, + performance_graph_StampPMsg, + performance_graph_InsertTool, + performance_graph_GetTool, + performance_graph_RemoveTool, +}; + /* for ClassFactory */ HRESULT create_dmperformance(REFIID iid, void **ret_iface) { @@ -1260,6 +1333,7 @@ HRESULT create_dmperformance(REFIID iid, void **ret_iface) *ret_iface = NULL; if (!(obj = calloc(1, sizeof(*obj)))) return E_OUTOFMEMORY; obj->IDirectMusicPerformance8_iface.lpVtbl = &performance_vtbl; + obj->IDirectMusicGraph_iface.lpVtbl = &performance_graph_vtbl; obj->ref = 1;
obj->pDefaultPath = NULL; diff --git a/dlls/dmime/tests/dmime.c b/dlls/dmime/tests/dmime.c index e95a1c02427..6dcb2b820c9 100644 --- a/dlls/dmime/tests/dmime.c +++ b/dlls/dmime/tests/dmime.c @@ -1536,8 +1536,7 @@ static void test_performance_graph(void)
/* performance exposes a graph interface but it's not an actual toolgraph */ hr = IDirectMusicPerformance_QueryInterface(performance, &IID_IDirectMusicGraph, (void **)&graph); - todo_wine ok(hr == S_OK, "got %#lx\n", hr); - if (hr != S_OK) goto skip_graph; + ok(hr == S_OK, "got %#lx\n", hr); hr = IDirectMusicGraph_InsertTool(graph, (IDirectMusicTool *)tool, NULL, 0, -1); ok(hr == E_NOTIMPL, "got %#lx\n", hr); hr = IDirectMusicGraph_GetTool(graph, 0, &tmp_tool); @@ -1578,7 +1577,6 @@ static void test_performance_graph(void) IDirectMusicGraph_Release(graph);
-skip_graph: /* performance doesn't have a default embedded toolgraph */ hr = IDirectMusicPerformance_GetGraph(performance, &graph); ok(hr == DMUS_E_NOT_FOUND, "got %#lx\n", hr); @@ -1604,8 +1602,7 @@ skip_graph:
/* test IDirectMusicGraph_StampPMsg usage */ hr = IDirectMusicPerformance_QueryInterface(performance, &IID_IDirectMusicGraph, (void **)&graph); - todo_wine ok(hr == S_OK, "got %#lx\n", hr); - if (hr != S_OK) goto skip_graph2; + ok(hr == S_OK, "got %#lx\n", hr);
memset(&msg, 0, sizeof(msg)); hr = IDirectMusicGraph_StampPMsg(graph, &msg); @@ -1636,7 +1633,6 @@ skip_graph: IDirectMusicGraph_Release(graph);
-skip_graph2: IDirectMusicPerformance_Release(performance); IDirectMusicTool_Release(tool); } @@ -1874,12 +1870,11 @@ static void test_performance_pmsg(void) msg->dwFlags = DMUS_PMSGF_REFTIME; msg->dwType = DMUS_PMSGT_USER;
- graph = NULL; hr = IDirectMusicPerformance_QueryInterface(performance, &IID_IDirectMusicGraph, (void **)&graph); + ok(hr == S_OK, "got %#lx\n", hr); + hr = IDirectMusicGraph_StampPMsg(graph, msg); todo_wine ok(hr == S_OK, "got %#lx\n", hr); - if (graph) hr = IDirectMusicGraph_StampPMsg(graph, msg); - todo_wine ok(hr == S_OK, "got %#lx\n", hr); - if (graph) IDirectMusicGraph_Release(graph); + IDirectMusicGraph_Release(graph);
hr = IDirectMusicPerformance_SendPMsg(performance, msg); ok(hr == S_OK, "got %#lx\n", hr); @@ -1906,11 +1901,10 @@ static void test_performance_pmsg(void) msg->dwType = DMUS_PMSGT_USER;
hr = IDirectMusicPerformance_QueryInterface(performance, &IID_IDirectMusicGraph, (void **)&graph); - todo_wine ok(hr == S_OK, "got %#lx\n", hr); - if (!graph) hr = S_OK; - else hr = IDirectMusicGraph_StampPMsg(graph, msg); ok(hr == S_OK, "got %#lx\n", hr); - if (graph) IDirectMusicGraph_Release(graph); + hr = IDirectMusicGraph_StampPMsg(graph, msg); + todo_wine ok(hr == S_OK, "got %#lx\n", hr); + IDirectMusicGraph_Release(graph);
msg->dwFlags &= ~(DMUS_PMSGF_TOOL_IMMEDIATE | DMUS_PMSGF_TOOL_QUEUE | DMUS_PMSGF_TOOL_ATTIME); msg->dwFlags |= delivery_flags[i]; diff --git a/dlls/dmime/tests/performance.c b/dlls/dmime/tests/performance.c index 4af91fc3130..5cb91a78387 100644 --- a/dlls/dmime/tests/performance.c +++ b/dlls/dmime/tests/performance.c @@ -627,7 +627,7 @@ static void test_performance_graph(void) ok(graph2 == NULL, "unexpected pointer.\n");
hr = IDirectMusicPerformance8_QueryInterface(perf, &IID_IDirectMusicGraph, (void**)&graph); - todo_wine ok(hr == S_OK, "Failed: %#lx\n", hr); + ok(hr == S_OK, "Failed: %#lx\n", hr);
if (graph) IDirectMusicGraph_Release(graph);