2 * Copyright 2012, 2014 Michael Stefaniuc
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include <wine/test.h>
25 #include <audioclient.h>
27 #define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
29 static BOOL
missing_dmime(void)
31 IDirectMusicSegment8
*dms
;
32 HRESULT hr
= CoCreateInstance(&CLSID_DirectMusicSegment
, NULL
, CLSCTX_INPROC_SERVER
,
33 &IID_IDirectMusicSegment
, (void**)&dms
);
35 if (hr
== S_OK
&& dms
)
37 IDirectMusicSegment_Release(dms
);
43 static void test_COM_audiopath(void)
45 IDirectMusicAudioPath
*dmap
;
47 IDirectMusicPerformance8
*performance
;
51 hr
= CoCreateInstance(&CLSID_DirectMusicPerformance
, NULL
, CLSCTX_INPROC_SERVER
,
52 &IID_IDirectMusicPerformance8
, (void**)&performance
);
53 ok(hr
== S_OK
|| broken(hr
== E_NOINTERFACE
),
54 "DirectMusicPerformance create failed: %08x\n", hr
);
56 win_skip("IDirectMusicPerformance8 not available\n");
59 hr
= IDirectMusicPerformance8_InitAudio(performance
, NULL
, NULL
, NULL
,
60 DMUS_APATH_SHARED_STEREOPLUSREVERB
, 64, DMUS_AUDIOF_ALL
, NULL
);
61 ok(hr
== S_OK
|| hr
== DSERR_NODRIVER
||
62 broken(hr
== AUDCLNT_E_ENDPOINT_CREATE_FAILED
), /* Win 10 testbot */
63 "DirectMusicPerformance_InitAudio failed: %08x\n", hr
);
65 skip("Audio failed to initialize\n");
68 hr
= IDirectMusicPerformance8_GetDefaultAudioPath(performance
, &dmap
);
69 ok(hr
== S_OK
, "DirectMusicPerformance_GetDefaultAudioPath failed: %08x\n", hr
);
71 /* IDirectMusicObject and IPersistStream are not supported */
72 hr
= IDirectMusicAudioPath_QueryInterface(dmap
, &IID_IDirectMusicObject
, (void**)&unk
);
73 todo_wine
ok(FAILED(hr
) && !unk
, "Unexpected IDirectMusicObject interface: hr=%08x, iface=%p\n",
75 if (unk
) IUnknown_Release(unk
);
76 hr
= IDirectMusicAudioPath_QueryInterface(dmap
, &IID_IPersistStream
, (void**)&unk
);
77 todo_wine
ok(FAILED(hr
) && !unk
, "Unexpected IPersistStream interface: hr=%08x, iface=%p\n",
79 if (unk
) IUnknown_Release(unk
);
81 /* Same refcount for all DirectMusicAudioPath interfaces */
82 refcount
= IDirectMusicAudioPath_AddRef(dmap
);
83 ok(refcount
== 3, "refcount == %u, expected 3\n", refcount
);
85 hr
= IDirectMusicAudioPath_QueryInterface(dmap
, &IID_IUnknown
, (void**)&unk
);
86 ok(hr
== S_OK
, "QueryInterface for IID_IUnknown failed: %08x\n", hr
);
87 ok(unk
== (IUnknown
*)dmap
, "got %p, %p\n", unk
, dmap
);
88 refcount
= IUnknown_AddRef(unk
);
89 ok(refcount
== 5, "refcount == %u, expected 5\n", refcount
);
90 refcount
= IUnknown_Release(unk
);
92 while (IDirectMusicAudioPath_Release(dmap
) > 1); /* performance has a reference too */
93 IDirectMusicPerformance8_CloseDown(performance
);
94 IDirectMusicPerformance8_Release(performance
);
97 static void test_COM_audiopathconfig(void)
99 IDirectMusicAudioPath
*dmap
= (IDirectMusicAudioPath
*)0xdeadbeef;
100 IDirectMusicObject
*dmo
;
106 /* COM aggregation */
107 hr
= CoCreateInstance(&CLSID_DirectMusicAudioPathConfig
, (IUnknown
*)&dmap
, CLSCTX_INPROC_SERVER
,
108 &IID_IUnknown
, (void**)&dmap
);
109 if (hr
== REGDB_E_CLASSNOTREG
) {
110 win_skip("DirectMusicAudioPathConfig not registered\n");
113 ok(hr
== CLASS_E_NOAGGREGATION
,
114 "DirectMusicAudioPathConfig create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr
);
115 ok(!dmap
, "dmap = %p\n", dmap
);
117 /* IDirectMusicAudioPath not supported */
118 hr
= CoCreateInstance(&CLSID_DirectMusicAudioPathConfig
, NULL
, CLSCTX_INPROC_SERVER
,
119 &IID_IDirectMusicAudioPath
, (void**)&dmap
);
120 todo_wine
ok(FAILED(hr
) && !dmap
,
121 "Unexpected IDirectMusicAudioPath interface: hr=%08x, iface=%p\n", hr
, dmap
);
123 /* IDirectMusicObject and IPersistStream supported */
124 hr
= CoCreateInstance(&CLSID_DirectMusicAudioPathConfig
, NULL
, CLSCTX_INPROC_SERVER
,
125 &IID_IPersistStream
, (void**)&ps
);
126 ok(hr
== S_OK
, "DirectMusicObject create failed: %08x, expected S_OK\n", hr
);
127 IPersistStream_Release(ps
);
128 hr
= CoCreateInstance(&CLSID_DirectMusicAudioPathConfig
, NULL
, CLSCTX_INPROC_SERVER
,
129 &IID_IDirectMusicObject
, (void**)&dmo
);
130 ok(hr
== S_OK
, "DirectMusicObject create failed: %08x, expected S_OK\n", hr
);
132 /* Same refcount for all DirectMusicObject interfaces */
133 refcount
= IDirectMusicObject_AddRef(dmo
);
134 ok(refcount
== 2, "refcount == %u, expected 2\n", refcount
);
136 hr
= IDirectMusicObject_QueryInterface(dmo
, &IID_IPersistStream
, (void**)&ps
);
137 ok(hr
== S_OK
, "QueryInterface for IID_IPersistStream failed: %08x\n", hr
);
138 refcount
= IPersistStream_AddRef(ps
);
139 ok(refcount
== 4, "refcount == %u, expected 4\n", refcount
);
140 IPersistStream_Release(ps
);
142 hr
= IDirectMusicObject_QueryInterface(dmo
, &IID_IUnknown
, (void**)&unk
);
143 ok(hr
== S_OK
, "QueryInterface for IID_IUnknown failed: %08x\n", hr
);
144 refcount
= IUnknown_AddRef(unk
);
145 ok(refcount
== 5, "refcount == %u, expected 5\n", refcount
);
146 refcount
= IUnknown_Release(unk
);
148 /* IDirectMusicAudioPath still not supported */
149 hr
= IDirectMusicObject_QueryInterface(dmo
, &IID_IDirectMusicAudioPath
, (void**)&dmap
);
150 todo_wine
ok(FAILED(hr
) && !dmap
,
151 "Unexpected IDirectMusicAudioPath interface: hr=%08x, iface=%p\n", hr
, dmap
);
153 while (IDirectMusicObject_Release(dmo
));
157 static void test_COM_graph(void)
159 IDirectMusicGraph
*dmg
= (IDirectMusicGraph
*)0xdeadbeef;
160 IDirectMusicObject
*dmo
;
166 /* COM aggregation */
167 hr
= CoCreateInstance(&CLSID_DirectMusicGraph
, (IUnknown
*)&dmg
, CLSCTX_INPROC_SERVER
,
168 &IID_IUnknown
, (void**)&dmg
);
169 ok(hr
== CLASS_E_NOAGGREGATION
,
170 "DirectMusicGraph create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr
);
171 ok(!dmg
, "dmg = %p\n", dmg
);
174 hr
= CoCreateInstance(&CLSID_DirectMusicGraph
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IClassFactory
,
176 ok(hr
== E_NOINTERFACE
, "DirectMusicGraph create failed: %08x, expected E_NOINTERFACE\n", hr
);
178 /* Same refcount for all DirectMusicGraph interfaces */
179 hr
= CoCreateInstance(&CLSID_DirectMusicGraph
, NULL
, CLSCTX_INPROC_SERVER
,
180 &IID_IDirectMusicGraph
, (void**)&dmg
);
181 ok(hr
== S_OK
, "DirectMusicGraph create failed: %08x, expected S_OK\n", hr
);
182 refcount
= IDirectMusicGraph_AddRef(dmg
);
183 ok(refcount
== 2, "refcount == %u, expected 2\n", refcount
);
185 hr
= IDirectMusicGraph_QueryInterface(dmg
, &IID_IDirectMusicObject
, (void**)&dmo
);
186 if (hr
== E_NOINTERFACE
) {
187 win_skip("DirectMusicGraph without IDirectMusicObject\n");
190 ok(hr
== S_OK
, "QueryInterface for IID_IDirectMusicObject failed: %08x\n", hr
);
191 refcount
= IDirectMusicObject_AddRef(dmo
);
192 ok(refcount
== 4, "refcount == %u, expected 4\n", refcount
);
193 refcount
= IDirectMusicObject_Release(dmo
);
195 hr
= IDirectMusicGraph_QueryInterface(dmg
, &IID_IPersistStream
, (void**)&ps
);
196 ok(hr
== S_OK
, "QueryInterface for IID_IPersistStream failed: %08x\n", hr
);
197 refcount
= IPersistStream_AddRef(ps
);
198 ok(refcount
== 5, "refcount == %u, expected 5\n", refcount
);
199 refcount
= IPersistStream_Release(ps
);
201 hr
= IDirectMusicGraph_QueryInterface(dmg
, &IID_IUnknown
, (void**)&unk
);
202 ok(hr
== S_OK
, "QueryInterface for IID_IUnknown failed: %08x\n", hr
);
203 refcount
= IUnknown_AddRef(unk
);
204 ok(refcount
== 6, "refcount == %u, expected 6\n", refcount
);
205 refcount
= IUnknown_Release(unk
);
207 while (IDirectMusicGraph_Release(dmg
));
210 static void test_COM_segment(void)
212 IDirectMusicSegment8
*dms
= (IDirectMusicSegment8
*)0xdeadbeef;
213 IDirectMusicObject
*dmo
;
214 IPersistStream
*stream
;
219 /* COM aggregation */
220 hr
= CoCreateInstance(&CLSID_DirectMusicSegment
, (IUnknown
*)&dms
, CLSCTX_INPROC_SERVER
,
221 &IID_IUnknown
, (void**)&dms
);
222 ok(hr
== CLASS_E_NOAGGREGATION
,
223 "DirectMusicSegment create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr
);
224 ok(!dms
, "dms = %p\n", dms
);
227 hr
= CoCreateInstance(&CLSID_DirectMusicSegment
, NULL
, CLSCTX_INPROC_SERVER
,
228 &IID_IDirectSound
, (void**)&dms
);
229 ok(hr
== E_NOINTERFACE
,
230 "DirectMusicSegment create failed: %08x, expected E_NOINTERFACE\n", hr
);
233 hr
= CoCreateInstance(&CLSID_DirectMusicSegment
, NULL
, CLSCTX_INPROC_SERVER
,
234 &IID_IDirectMusicSegment8
, (void**)&dms
);
235 if (hr
== E_NOINTERFACE
) {
236 win_skip("DirectMusicSegment without IDirectMusicSegment8\n");
239 ok(hr
== S_OK
, "DirectMusicSegment create failed: %08x, expected S_OK\n", hr
);
240 refcount
= IDirectMusicSegment8_AddRef(dms
);
241 ok (refcount
== 2, "refcount == %u, expected 2\n", refcount
);
242 hr
= IDirectMusicSegment8_QueryInterface(dms
, &IID_IDirectMusicObject
, (void**)&dmo
);
243 ok(hr
== S_OK
, "QueryInterface for IID_IDirectMusicObject failed: %08x\n", hr
);
244 IDirectMusicSegment8_AddRef(dms
);
245 refcount
= IDirectMusicSegment8_Release(dms
);
246 ok (refcount
== 3, "refcount == %u, expected 3\n", refcount
);
247 hr
= IDirectMusicSegment8_QueryInterface(dms
, &IID_IPersistStream
, (void**)&stream
);
248 ok(hr
== S_OK
, "QueryInterface for IID_IPersistStream failed: %08x\n", hr
);
249 refcount
= IDirectMusicSegment8_Release(dms
);
250 ok (refcount
== 3, "refcount == %u, expected 3\n", refcount
);
251 hr
= IDirectMusicSegment8_QueryInterface(dms
, &IID_IUnknown
, (void**)&unk
);
252 ok(hr
== S_OK
, "QueryInterface for IID_IUnknown failed: %08x\n", hr
);
253 refcount
= IUnknown_Release(unk
);
254 ok (refcount
== 3, "refcount == %u, expected 3\n", refcount
);
255 refcount
= IDirectMusicObject_Release(dmo
);
256 ok (refcount
== 2, "refcount == %u, expected 2\n", refcount
);
257 refcount
= IPersistStream_Release(stream
);
258 ok (refcount
== 1, "refcount == %u, expected 1\n", refcount
);
259 refcount
= IDirectMusicSegment8_Release(dms
);
260 ok (refcount
== 0, "refcount == %u, expected 0\n", refcount
);
263 static void test_COM_segmentstate(void)
265 IDirectMusicSegmentState8
*dmss8
= (IDirectMusicSegmentState8
*)0xdeadbeef;
270 /* COM aggregation */
271 hr
= CoCreateInstance(&CLSID_DirectMusicSegmentState
, (IUnknown
*)&dmss8
, CLSCTX_INPROC_SERVER
,
272 &IID_IUnknown
, (void**)&dmss8
);
273 ok(hr
== CLASS_E_NOAGGREGATION
,
274 "DirectMusicSegmentState8 create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr
);
275 ok(!dmss8
, "dmss8 = %p\n", dmss8
);
278 hr
= CoCreateInstance(&CLSID_DirectMusicSegmentState
, NULL
, CLSCTX_INPROC_SERVER
,
279 &IID_IDirectMusicObject
, (void**)&dmss8
);
280 ok(hr
== E_NOINTERFACE
,
281 "DirectMusicSegmentState8 create failed: %08x, expected E_NOINTERFACE\n", hr
);
283 /* Same refcount for all DirectMusicSegmentState interfaces */
284 hr
= CoCreateInstance(&CLSID_DirectMusicSegmentState
, NULL
, CLSCTX_INPROC_SERVER
,
285 &IID_IDirectMusicSegmentState8
, (void**)&dmss8
);
286 if (hr
== E_NOINTERFACE
) {
287 win_skip("DirectMusicSegmentState without IDirectMusicSegmentState8\n");
290 ok(hr
== S_OK
, "DirectMusicSegmentState8 create failed: %08x, expected S_OK\n", hr
);
291 refcount
= IDirectMusicSegmentState8_AddRef(dmss8
);
292 ok(refcount
== 2, "refcount == %u, expected 2\n", refcount
);
294 hr
= IDirectMusicSegmentState8_QueryInterface(dmss8
, &IID_IUnknown
, (void**)&unk
);
295 ok(hr
== S_OK
, "QueryInterface for IID_IUnknown failed: %08x\n", hr
);
296 refcount
= IUnknown_AddRef(unk
);
297 ok(refcount
== 4, "refcount == %u, expected 4\n", refcount
);
298 refcount
= IUnknown_Release(unk
);
300 hr
= IDirectMusicSegmentState8_QueryInterface(dmss8
, &IID_IUnknown
, NULL
);
301 ok(hr
== E_POINTER
, "got %08x\n", hr
);
303 while (IDirectMusicSegmentState8_Release(dmss8
));
306 static void test_COM_track(void)
308 IDirectMusicTrack
*dmt
;
309 IDirectMusicTrack8
*dmt8
;
314 #define X(class) &CLSID_ ## class, #class
320 { X(DirectMusicLyricsTrack
), TRUE
},
321 { X(DirectMusicMarkerTrack
), FALSE
},
322 { X(DirectMusicParamControlTrack
), TRUE
},
323 { X(DirectMusicSegmentTriggerTrack
), TRUE
},
324 { X(DirectMusicSeqTrack
), TRUE
},
325 { X(DirectMusicSysExTrack
), TRUE
},
326 { X(DirectMusicTempoTrack
), TRUE
},
327 { X(DirectMusicTimeSigTrack
), FALSE
},
328 { X(DirectMusicWaveTrack
), TRUE
}
333 for (i
= 0; i
< ARRAY_SIZE(class); i
++) {
334 trace("Testing %s\n", class[i
].name
);
335 /* COM aggregation */
336 dmt8
= (IDirectMusicTrack8
*)0xdeadbeef;
337 hr
= CoCreateInstance(class[i
].clsid
, (IUnknown
*)&dmt8
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
,
339 if (hr
== REGDB_E_CLASSNOTREG
) {
340 win_skip("%s not registered\n", class[i
].name
);
343 ok(hr
== CLASS_E_NOAGGREGATION
,
344 "%s create failed: %08x, expected CLASS_E_NOAGGREGATION\n", class[i
].name
, hr
);
345 ok(!dmt8
, "dmt8 = %p\n", dmt8
);
348 hr
= CoCreateInstance(class[i
].clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IDirectMusicObject
,
350 ok(hr
== E_NOINTERFACE
, "%s create failed: %08x, expected E_NOINTERFACE\n",
353 /* Same refcount for all DirectMusicTrack interfaces */
354 hr
= CoCreateInstance(class[i
].clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IDirectMusicTrack
,
356 ok(hr
== S_OK
, "%s create failed: %08x, expected S_OK\n", class[i
].name
, hr
);
357 refcount
= IDirectMusicTrack_AddRef(dmt
);
358 ok(refcount
== 2, "refcount == %u, expected 2\n", refcount
);
360 hr
= IDirectMusicTrack_QueryInterface(dmt
, &IID_IPersistStream
, (void**)&ps
);
361 ok(hr
== S_OK
, "QueryInterface for IID_IPersistStream failed: %08x\n", hr
);
362 refcount
= IPersistStream_AddRef(ps
);
363 ok(refcount
== 4, "refcount == %u, expected 4\n", refcount
);
364 IPersistStream_Release(ps
);
366 hr
= IDirectMusicTrack_QueryInterface(dmt
, &IID_IUnknown
, (void**)&unk
);
367 ok(hr
== S_OK
, "QueryInterface for IID_IUnknown failed: %08x\n", hr
);
368 refcount
= IUnknown_AddRef(unk
);
369 ok(refcount
== 5, "refcount == %u, expected 5\n", refcount
);
370 refcount
= IUnknown_Release(unk
);
372 hr
= IDirectMusicTrack_QueryInterface(dmt
, &IID_IDirectMusicTrack8
, (void**)&dmt8
);
373 if (class[i
].has_dmt8
) {
374 ok(hr
== S_OK
, "QueryInterface for IID_IDirectMusicTrack8 failed: %08x\n", hr
);
375 refcount
= IDirectMusicTrack8_AddRef(dmt8
);
376 ok(refcount
== 6, "refcount == %u, expected 6\n", refcount
);
377 refcount
= IDirectMusicTrack8_Release(dmt8
);
379 ok(hr
== E_NOINTERFACE
, "QueryInterface for IID_IDirectMusicTrack8 failed: %08x\n", hr
);
380 refcount
= IDirectMusicTrack_AddRef(dmt
);
381 ok(refcount
== 5, "refcount == %u, expected 5\n", refcount
);
384 while (IDirectMusicTrack_Release(dmt
));
388 static void test_audiopathconfig(void)
390 IDirectMusicObject
*dmo
;
396 hr
= CoCreateInstance(&CLSID_DirectMusicAudioPathConfig
, NULL
, CLSCTX_INPROC_SERVER
,
397 &IID_IDirectMusicObject
, (void**)&dmo
);
398 if (hr
== REGDB_E_CLASSNOTREG
) {
399 win_skip("DirectMusicAudioPathConfig not registered\n");
402 ok(hr
== S_OK
, "DirectMusicAudioPathConfig create failed: %08x, expected S_OK\n", hr
);
405 hr
= IDirectMusicObject_QueryInterface(dmo
, &IID_IPersistStream
, (void**)&ps
);
406 ok(hr
== S_OK
, "QueryInterface for IID_IPersistStream failed: %08x\n", hr
);
407 hr
= IPersistStream_GetClassID(ps
, &class);
408 ok(hr
== S_OK
, "IPersistStream_GetClassID failed: %08x\n", hr
);
409 ok(IsEqualGUID(&class, &CLSID_DirectMusicAudioPathConfig
),
410 "Expected class CLSID_DirectMusicAudioPathConfig got %s\n", wine_dbgstr_guid(&class));
412 /* Unimplemented IPersistStream methods */
413 hr
= IPersistStream_IsDirty(ps
);
414 ok(hr
== S_FALSE
, "IPersistStream_IsDirty failed: %08x\n", hr
);
415 hr
= IPersistStream_GetSizeMax(ps
, &size
);
416 ok(hr
== E_NOTIMPL
, "IPersistStream_GetSizeMax failed: %08x\n", hr
);
417 hr
= IPersistStream_Save(ps
, NULL
, TRUE
);
418 ok(hr
== E_NOTIMPL
, "IPersistStream_Save failed: %08x\n", hr
);
420 while (IDirectMusicObject_Release(dmo
));
423 static void test_graph(void)
425 IDirectMusicGraph
*dmg
;
431 hr
= CoCreateInstance(&CLSID_DirectMusicGraph
, NULL
, CLSCTX_INPROC_SERVER
,
432 &IID_IDirectMusicGraph
, (void**)&dmg
);
433 ok(hr
== S_OK
, "DirectMusicGraph create failed: %08x, expected S_OK\n", hr
);
436 hr
= IDirectMusicGraph_QueryInterface(dmg
, &IID_IPersistStream
, (void**)&ps
);
437 ok(hr
== S_OK
, "QueryInterface for IID_IPersistStream failed: %08x\n", hr
);
438 hr
= IPersistStream_GetClassID(ps
, &class);
439 ok(hr
== S_OK
|| broken(hr
== E_NOTIMPL
) /* win2k */, "IPersistStream_GetClassID failed: %08x\n", hr
);
441 ok(IsEqualGUID(&class, &CLSID_DirectMusicGraph
),
442 "Expected class CLSID_DirectMusicGraph got %s\n", wine_dbgstr_guid(&class));
444 /* Unimplemented IPersistStream methods */
445 hr
= IPersistStream_IsDirty(ps
);
446 ok(hr
== S_FALSE
, "IPersistStream_IsDirty failed: %08x\n", hr
);
447 hr
= IPersistStream_GetSizeMax(ps
, &size
);
448 ok(hr
== E_NOTIMPL
, "IPersistStream_GetSizeMax failed: %08x\n", hr
);
449 hr
= IPersistStream_Save(ps
, NULL
, TRUE
);
450 ok(hr
== E_NOTIMPL
, "IPersistStream_Save failed: %08x\n", hr
);
452 while (IDirectMusicGraph_Release(dmg
));
455 static void test_segment(void)
457 IDirectMusicSegment
*dms
;
463 hr
= CoCreateInstance(&CLSID_DirectMusicSegment
, NULL
, CLSCTX_INPROC_SERVER
,
464 &IID_IDirectMusicSegment
, (void**)&dms
);
465 ok(hr
== S_OK
, "DirectMusicSegment create failed: %08x, expected S_OK\n", hr
);
468 hr
= IDirectMusicSegment_QueryInterface(dms
, &IID_IPersistStream
, (void**)&ps
);
469 ok(hr
== S_OK
, "QueryInterface for IID_IPersistStream failed: %08x\n", hr
);
470 hr
= IPersistStream_GetClassID(ps
, &class);
471 ok(hr
== S_OK
|| broken(hr
== E_NOTIMPL
) /* win2k */, "IPersistStream_GetClassID failed: %08x\n", hr
);
473 ok(IsEqualGUID(&class, &CLSID_DirectMusicSegment
),
474 "Expected class CLSID_DirectMusicSegment got %s\n", wine_dbgstr_guid(&class));
476 /* Unimplemented IPersistStream methods */
477 hr
= IPersistStream_IsDirty(ps
);
478 ok(hr
== S_FALSE
, "IPersistStream_IsDirty failed: %08x\n", hr
);
479 hr
= IPersistStream_GetSizeMax(ps
, &size
);
480 ok(hr
== E_NOTIMPL
, "IPersistStream_GetSizeMax failed: %08x\n", hr
);
481 hr
= IPersistStream_Save(ps
, NULL
, TRUE
);
482 ok(hr
== E_NOTIMPL
, "IPersistStream_Save failed: %08x\n", hr
);
484 while (IDirectMusicSegment_Release(dms
));
487 static void test_track(void)
489 IDirectMusicTrack
*dmt
;
490 IDirectMusicTrack8
*dmt8
;
495 #define X(class) &CLSID_ ## class, #class
501 { X(DirectMusicLyricsTrack
), TRUE
},
502 { X(DirectMusicMarkerTrack
), TRUE
},
503 { X(DirectMusicParamControlTrack
), TRUE
},
504 { X(DirectMusicSegmentTriggerTrack
), TRUE
},
505 { X(DirectMusicSeqTrack
), FALSE
},
506 { X(DirectMusicSysExTrack
), FALSE
},
507 { X(DirectMusicTempoTrack
), TRUE
},
508 { X(DirectMusicTimeSigTrack
), TRUE
},
509 { X(DirectMusicWaveTrack
), TRUE
}
514 for (i
= 0; i
< ARRAY_SIZE(class); i
++) {
515 trace("Testing %s\n", class[i
].name
);
516 hr
= CoCreateInstance(class[i
].clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IDirectMusicTrack
,
518 ok(hr
== S_OK
, "%s create failed: %08x, expected S_OK\n", class[i
].name
, hr
);
520 /* IDirectMusicTrack */
521 if (!class[i
].has_param
) {
522 hr
= IDirectMusicTrack_GetParam(dmt
, NULL
, 0, NULL
, NULL
);
523 ok(hr
== E_NOTIMPL
, "IDirectMusicTrack_GetParam failed: %08x\n", hr
);
524 hr
= IDirectMusicTrack_SetParam(dmt
, NULL
, 0, NULL
);
525 ok(hr
== E_NOTIMPL
, "IDirectMusicTrack_SetParam failed: %08x\n", hr
);
526 hr
= IDirectMusicTrack_IsParamSupported(dmt
, NULL
);
527 ok(hr
== E_NOTIMPL
, "IDirectMusicTrack_IsParamSupported failed: %08x\n", hr
);
529 if (class[i
].clsid
!= &CLSID_DirectMusicMarkerTrack
&&
530 class[i
].clsid
!= &CLSID_DirectMusicTimeSigTrack
) {
531 hr
= IDirectMusicTrack_AddNotificationType(dmt
, NULL
);
532 ok(hr
== E_NOTIMPL
, "IDirectMusicTrack_AddNotificationType failed: %08x\n", hr
);
533 hr
= IDirectMusicTrack_RemoveNotificationType(dmt
, NULL
);
534 ok(hr
== E_NOTIMPL
, "IDirectMusicTrack_RemoveNotificationType failed: %08x\n", hr
);
536 hr
= IDirectMusicTrack_Clone(dmt
, 0, 0, NULL
);
537 todo_wine
ok(hr
== E_POINTER
, "IDirectMusicTrack_Clone failed: %08x\n", hr
);
539 /* IDirectMusicTrack8 */
540 hr
= IDirectMusicTrack_QueryInterface(dmt
, &IID_IDirectMusicTrack8
, (void**)&dmt8
);
542 hr
= IDirectMusicTrack8_PlayEx(dmt8
, NULL
, 0, 0, 0, 0, NULL
, NULL
, 0);
543 todo_wine
ok(hr
== E_POINTER
, "IDirectMusicTrack8_PlayEx failed: %08x\n", hr
);
544 if (!class[i
].has_param
) {
545 hr
= IDirectMusicTrack8_GetParamEx(dmt8
, NULL
, 0, NULL
, NULL
, NULL
, 0);
546 ok(hr
== E_NOTIMPL
, "IDirectMusicTrack8_GetParamEx failed: %08x\n", hr
);
547 hr
= IDirectMusicTrack8_SetParamEx(dmt8
, NULL
, 0, NULL
, NULL
, 0);
548 ok(hr
== E_NOTIMPL
, "IDirectMusicTrack8_SetParamEx failed: %08x\n", hr
);
550 hr
= IDirectMusicTrack8_Compose(dmt8
, NULL
, 0, NULL
);
551 ok(hr
== E_NOTIMPL
, "IDirectMusicTrack8_Compose failed: %08x\n", hr
);
552 hr
= IDirectMusicTrack8_Join(dmt8
, NULL
, 0, NULL
, 0, NULL
);
553 if (class[i
].clsid
== &CLSID_DirectMusicTempoTrack
)
554 todo_wine
ok(hr
== E_POINTER
, "IDirectMusicTrack8_Join failed: %08x\n", hr
);
556 ok(hr
== E_NOTIMPL
, "IDirectMusicTrack8_Join failed: %08x\n", hr
);
557 IDirectMusicTrack8_Release(dmt8
);
561 hr
= IDirectMusicTrack_QueryInterface(dmt
, &IID_IPersistStream
, (void**)&ps
);
562 ok(hr
== S_OK
, "QueryInterface for IID_IPersistStream failed: %08x\n", hr
);
563 hr
= IPersistStream_GetClassID(ps
, &classid
);
564 ok(hr
== S_OK
, "IPersistStream_GetClassID failed: %08x\n", hr
);
565 ok(IsEqualGUID(&classid
, class[i
].clsid
),
566 "Expected class %s got %s\n", class[i
].name
, wine_dbgstr_guid(&classid
));
567 hr
= IPersistStream_IsDirty(ps
);
568 ok(hr
== S_FALSE
, "IPersistStream_IsDirty failed: %08x\n", hr
);
570 /* Unimplemented IPersistStream methods */
571 hr
= IPersistStream_GetSizeMax(ps
, &size
);
572 ok(hr
== E_NOTIMPL
, "IPersistStream_GetSizeMax failed: %08x\n", hr
);
573 hr
= IPersistStream_Save(ps
, NULL
, TRUE
);
574 ok(hr
== E_NOTIMPL
, "IPersistStream_Save failed: %08x\n", hr
);
576 while (IDirectMusicTrack_Release(dmt
));
586 skip("dmime not available\n");
590 test_COM_audiopath();
591 test_COM_audiopathconfig();
594 test_COM_segmentstate();
596 test_audiopathconfig();