2014-01-10 10:42:57 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2012, 2014 Michael Stefaniuc
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <windef.h>
|
|
|
|
#include <wine/test.h>
|
2018-03-02 01:16:08 +01:00
|
|
|
#include <ole2.h>
|
2014-01-10 10:42:57 +01:00
|
|
|
#include <dmusici.h>
|
2018-03-02 01:16:08 +01:00
|
|
|
#include <dmusicf.h>
|
2017-01-13 11:10:42 +01:00
|
|
|
#include <audioclient.h>
|
2017-06-28 12:50:52 +02:00
|
|
|
#include <guiddef.h>
|
2014-01-10 10:42:57 +01:00
|
|
|
|
|
|
|
static BOOL missing_dmime(void)
|
|
|
|
{
|
|
|
|
IDirectMusicSegment8 *dms;
|
|
|
|
HRESULT hr = CoCreateInstance(&CLSID_DirectMusicSegment, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IDirectMusicSegment, (void**)&dms);
|
|
|
|
|
|
|
|
if (hr == S_OK && dms)
|
|
|
|
{
|
|
|
|
IDirectMusicSegment_Release(dms);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2014-01-10 10:54:48 +01:00
|
|
|
static void test_COM_audiopath(void)
|
|
|
|
{
|
|
|
|
IDirectMusicAudioPath *dmap;
|
|
|
|
IUnknown *unk;
|
|
|
|
IDirectMusicPerformance8 *performance;
|
2017-06-28 12:50:52 +02:00
|
|
|
IDirectSoundBuffer *dsound;
|
|
|
|
IDirectSoundBuffer8 *dsound8;
|
|
|
|
IDirectSoundNotify *notify;
|
|
|
|
IDirectSound3DBuffer *dsound3d;
|
|
|
|
IKsPropertySet *propset;
|
2014-01-10 10:54:48 +01:00
|
|
|
ULONG refcount;
|
|
|
|
HRESULT hr;
|
2017-06-28 12:50:52 +02:00
|
|
|
DWORD buffer = 0;
|
2014-01-10 10:54:48 +01:00
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicPerformance, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IDirectMusicPerformance8, (void**)&performance);
|
|
|
|
ok(hr == S_OK || broken(hr == E_NOINTERFACE),
|
|
|
|
"DirectMusicPerformance create failed: %08x\n", hr);
|
|
|
|
if (!performance) {
|
|
|
|
win_skip("IDirectMusicPerformance8 not available\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
hr = IDirectMusicPerformance8_InitAudio(performance, NULL, NULL, NULL,
|
|
|
|
DMUS_APATH_SHARED_STEREOPLUSREVERB, 64, DMUS_AUDIOF_ALL, NULL);
|
2017-01-13 11:10:42 +01:00
|
|
|
ok(hr == S_OK || hr == DSERR_NODRIVER ||
|
|
|
|
broken(hr == AUDCLNT_E_ENDPOINT_CREATE_FAILED), /* Win 10 testbot */
|
|
|
|
"DirectMusicPerformance_InitAudio failed: %08x\n", hr);
|
|
|
|
if (FAILED(hr)) {
|
|
|
|
skip("Audio failed to initialize\n");
|
2014-01-10 23:07:15 +01:00
|
|
|
return;
|
|
|
|
}
|
2014-01-10 10:54:48 +01:00
|
|
|
hr = IDirectMusicPerformance8_GetDefaultAudioPath(performance, &dmap);
|
|
|
|
ok(hr == S_OK, "DirectMusicPerformance_GetDefaultAudioPath failed: %08x\n", hr);
|
|
|
|
|
|
|
|
/* IDirectMusicObject and IPersistStream are not supported */
|
|
|
|
hr = IDirectMusicAudioPath_QueryInterface(dmap, &IID_IDirectMusicObject, (void**)&unk);
|
|
|
|
todo_wine ok(FAILED(hr) && !unk, "Unexpected IDirectMusicObject interface: hr=%08x, iface=%p\n",
|
|
|
|
hr, unk);
|
|
|
|
if (unk) IUnknown_Release(unk);
|
|
|
|
hr = IDirectMusicAudioPath_QueryInterface(dmap, &IID_IPersistStream, (void**)&unk);
|
|
|
|
todo_wine ok(FAILED(hr) && !unk, "Unexpected IPersistStream interface: hr=%08x, iface=%p\n",
|
|
|
|
hr, unk);
|
|
|
|
if (unk) IUnknown_Release(unk);
|
|
|
|
|
|
|
|
/* Same refcount for all DirectMusicAudioPath interfaces */
|
|
|
|
refcount = IDirectMusicAudioPath_AddRef(dmap);
|
|
|
|
ok(refcount == 3, "refcount == %u, expected 3\n", refcount);
|
|
|
|
|
|
|
|
hr = IDirectMusicAudioPath_QueryInterface(dmap, &IID_IUnknown, (void**)&unk);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
|
2015-04-27 01:10:26 +02:00
|
|
|
ok(unk == (IUnknown*)dmap, "got %p, %p\n", unk, dmap);
|
2014-01-10 10:54:48 +01:00
|
|
|
refcount = IUnknown_AddRef(unk);
|
|
|
|
ok(refcount == 5, "refcount == %u, expected 5\n", refcount);
|
|
|
|
refcount = IUnknown_Release(unk);
|
|
|
|
|
2017-06-28 12:50:52 +02:00
|
|
|
hr = IDirectMusicAudioPath_GetObjectInPath(dmap, DMUS_PCHANNEL_ALL, DMUS_PATH_BUFFER, buffer, &GUID_NULL,
|
|
|
|
0, &IID_IDirectSoundBuffer, (void**)&dsound);
|
|
|
|
ok(hr == S_OK, "Failed: %08x\n", hr);
|
|
|
|
IDirectSoundBuffer_Release(dsound);
|
|
|
|
|
|
|
|
hr = IDirectMusicAudioPath_GetObjectInPath(dmap, DMUS_PCHANNEL_ALL, DMUS_PATH_BUFFER, buffer, &GUID_NULL,
|
|
|
|
0, &IID_IDirectSoundBuffer8, (void**)&dsound8);
|
|
|
|
ok(hr == S_OK, "Failed: %08x\n", hr);
|
|
|
|
IDirectSoundBuffer8_Release(dsound8);
|
|
|
|
|
|
|
|
hr = IDirectMusicAudioPath_GetObjectInPath(dmap, DMUS_PCHANNEL_ALL, DMUS_PATH_BUFFER, buffer, &GUID_NULL,
|
|
|
|
0, &IID_IDirectSoundNotify, (void**)¬ify);
|
|
|
|
ok(hr == E_NOINTERFACE, "Failed: %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IDirectMusicAudioPath_GetObjectInPath(dmap, DMUS_PCHANNEL_ALL, DMUS_PATH_BUFFER, buffer, &GUID_NULL,
|
|
|
|
0, &IID_IDirectSound3DBuffer, (void**)&dsound3d);
|
|
|
|
ok(hr == E_NOINTERFACE, "Failed: %08x\n", hr);
|
|
|
|
|
|
|
|
hr = IDirectMusicAudioPath_GetObjectInPath(dmap, DMUS_PCHANNEL_ALL, DMUS_PATH_BUFFER, buffer, &GUID_NULL,
|
|
|
|
0, &IID_IKsPropertySet, (void**)&propset);
|
|
|
|
todo_wine ok(hr == S_OK, "Failed: %08x\n", hr);
|
|
|
|
if (propset)
|
|
|
|
IKsPropertySet_Release(propset);
|
|
|
|
|
|
|
|
hr = IDirectMusicAudioPath_GetObjectInPath(dmap, DMUS_PCHANNEL_ALL, DMUS_PATH_BUFFER, buffer, &GUID_NULL,
|
|
|
|
0, &IID_IUnknown, (void**)&unk);
|
|
|
|
ok(hr == S_OK, "Failed: %08x\n", hr);
|
|
|
|
IUnknown_Release(unk);
|
|
|
|
|
|
|
|
hr = IDirectMusicAudioPath_GetObjectInPath(dmap, DMUS_PCHANNEL_ALL, DMUS_PATH_BUFFER, buffer, &GUID_NULL,
|
|
|
|
0, &GUID_NULL, (void**)&unk);
|
|
|
|
ok(hr == E_NOINTERFACE, "Failed: %08x\n", hr);
|
|
|
|
|
2014-01-10 10:54:48 +01:00
|
|
|
while (IDirectMusicAudioPath_Release(dmap) > 1); /* performance has a reference too */
|
|
|
|
IDirectMusicPerformance8_CloseDown(performance);
|
|
|
|
IDirectMusicPerformance8_Release(performance);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_COM_audiopathconfig(void)
|
|
|
|
{
|
|
|
|
IDirectMusicAudioPath *dmap = (IDirectMusicAudioPath*)0xdeadbeef;
|
|
|
|
IDirectMusicObject *dmo;
|
|
|
|
IPersistStream *ps;
|
|
|
|
IUnknown *unk;
|
|
|
|
ULONG refcount;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
/* COM aggregation */
|
2017-04-24 20:19:16 +02:00
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicAudioPathConfig, (IUnknown *)0xdeadbeef, CLSCTX_INPROC_SERVER,
|
2014-01-10 10:54:48 +01:00
|
|
|
&IID_IUnknown, (void**)&dmap);
|
|
|
|
if (hr == REGDB_E_CLASSNOTREG) {
|
|
|
|
win_skip("DirectMusicAudioPathConfig not registered\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok(hr == CLASS_E_NOAGGREGATION,
|
|
|
|
"DirectMusicAudioPathConfig create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr);
|
|
|
|
ok(!dmap, "dmap = %p\n", dmap);
|
|
|
|
|
|
|
|
/* IDirectMusicAudioPath not supported */
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicAudioPathConfig, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IDirectMusicAudioPath, (void**)&dmap);
|
|
|
|
todo_wine ok(FAILED(hr) && !dmap,
|
|
|
|
"Unexpected IDirectMusicAudioPath interface: hr=%08x, iface=%p\n", hr, dmap);
|
|
|
|
|
|
|
|
/* IDirectMusicObject and IPersistStream supported */
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicAudioPathConfig, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IPersistStream, (void**)&ps);
|
|
|
|
ok(hr == S_OK, "DirectMusicObject create failed: %08x, expected S_OK\n", hr);
|
|
|
|
IPersistStream_Release(ps);
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicAudioPathConfig, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IDirectMusicObject, (void**)&dmo);
|
|
|
|
ok(hr == S_OK, "DirectMusicObject create failed: %08x, expected S_OK\n", hr);
|
|
|
|
|
|
|
|
/* Same refcount for all DirectMusicObject interfaces */
|
|
|
|
refcount = IDirectMusicObject_AddRef(dmo);
|
|
|
|
ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
|
|
|
|
|
|
|
|
hr = IDirectMusicObject_QueryInterface(dmo, &IID_IPersistStream, (void**)&ps);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
|
|
|
|
refcount = IPersistStream_AddRef(ps);
|
|
|
|
ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
|
2015-01-15 12:09:15 +01:00
|
|
|
IPersistStream_Release(ps);
|
2014-01-10 10:54:48 +01:00
|
|
|
|
|
|
|
hr = IDirectMusicObject_QueryInterface(dmo, &IID_IUnknown, (void**)&unk);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
|
|
|
|
refcount = IUnknown_AddRef(unk);
|
|
|
|
ok(refcount == 5, "refcount == %u, expected 5\n", refcount);
|
|
|
|
refcount = IUnknown_Release(unk);
|
|
|
|
|
|
|
|
/* IDirectMusicAudioPath still not supported */
|
|
|
|
hr = IDirectMusicObject_QueryInterface(dmo, &IID_IDirectMusicAudioPath, (void**)&dmap);
|
|
|
|
todo_wine ok(FAILED(hr) && !dmap,
|
|
|
|
"Unexpected IDirectMusicAudioPath interface: hr=%08x, iface=%p\n", hr, dmap);
|
|
|
|
|
|
|
|
while (IDirectMusicObject_Release(dmo));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-10 10:48:05 +01:00
|
|
|
static void test_COM_graph(void)
|
|
|
|
{
|
|
|
|
IDirectMusicGraph *dmg = (IDirectMusicGraph*)0xdeadbeef;
|
|
|
|
IDirectMusicObject *dmo;
|
|
|
|
IPersistStream *ps;
|
|
|
|
IUnknown *unk;
|
|
|
|
ULONG refcount;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
/* COM aggregation */
|
2017-04-24 20:19:16 +02:00
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicGraph, (IUnknown *)0xdeadbeef, CLSCTX_INPROC_SERVER,
|
2014-01-10 10:48:05 +01:00
|
|
|
&IID_IUnknown, (void**)&dmg);
|
|
|
|
ok(hr == CLASS_E_NOAGGREGATION,
|
|
|
|
"DirectMusicGraph create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr);
|
|
|
|
ok(!dmg, "dmg = %p\n", dmg);
|
|
|
|
|
|
|
|
/* Invalid RIID */
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IClassFactory,
|
|
|
|
(void**)&dmg);
|
|
|
|
ok(hr == E_NOINTERFACE, "DirectMusicGraph create failed: %08x, expected E_NOINTERFACE\n", hr);
|
|
|
|
|
|
|
|
/* Same refcount for all DirectMusicGraph interfaces */
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicGraph, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IDirectMusicGraph, (void**)&dmg);
|
|
|
|
ok(hr == S_OK, "DirectMusicGraph create failed: %08x, expected S_OK\n", hr);
|
|
|
|
refcount = IDirectMusicGraph_AddRef(dmg);
|
|
|
|
ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
|
|
|
|
|
|
|
|
hr = IDirectMusicGraph_QueryInterface(dmg, &IID_IDirectMusicObject, (void**)&dmo);
|
|
|
|
if (hr == E_NOINTERFACE) {
|
|
|
|
win_skip("DirectMusicGraph without IDirectMusicObject\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IDirectMusicObject failed: %08x\n", hr);
|
|
|
|
refcount = IDirectMusicObject_AddRef(dmo);
|
|
|
|
ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
|
|
|
|
refcount = IDirectMusicObject_Release(dmo);
|
|
|
|
|
|
|
|
hr = IDirectMusicGraph_QueryInterface(dmg, &IID_IPersistStream, (void**)&ps);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
|
|
|
|
refcount = IPersistStream_AddRef(ps);
|
|
|
|
ok(refcount == 5, "refcount == %u, expected 5\n", refcount);
|
|
|
|
refcount = IPersistStream_Release(ps);
|
|
|
|
|
|
|
|
hr = IDirectMusicGraph_QueryInterface(dmg, &IID_IUnknown, (void**)&unk);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
|
|
|
|
refcount = IUnknown_AddRef(unk);
|
|
|
|
ok(refcount == 6, "refcount == %u, expected 6\n", refcount);
|
|
|
|
refcount = IUnknown_Release(unk);
|
|
|
|
|
|
|
|
while (IDirectMusicGraph_Release(dmg));
|
|
|
|
}
|
|
|
|
|
2014-01-10 10:42:57 +01:00
|
|
|
static void test_COM_segment(void)
|
|
|
|
{
|
|
|
|
IDirectMusicSegment8 *dms = (IDirectMusicSegment8*)0xdeadbeef;
|
|
|
|
IDirectMusicObject *dmo;
|
|
|
|
IPersistStream *stream;
|
|
|
|
IUnknown *unk;
|
|
|
|
ULONG refcount;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
/* COM aggregation */
|
2017-04-24 20:19:16 +02:00
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicSegment, (IUnknown *)0xdeadbeef, CLSCTX_INPROC_SERVER,
|
2014-01-10 10:42:57 +01:00
|
|
|
&IID_IUnknown, (void**)&dms);
|
|
|
|
ok(hr == CLASS_E_NOAGGREGATION,
|
|
|
|
"DirectMusicSegment create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr);
|
|
|
|
ok(!dms, "dms = %p\n", dms);
|
|
|
|
|
|
|
|
/* Invalid RIID */
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicSegment, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IDirectSound, (void**)&dms);
|
|
|
|
ok(hr == E_NOINTERFACE,
|
|
|
|
"DirectMusicSegment create failed: %08x, expected E_NOINTERFACE\n", hr);
|
|
|
|
|
|
|
|
/* Same refcount */
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicSegment, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IDirectMusicSegment8, (void**)&dms);
|
|
|
|
if (hr == E_NOINTERFACE) {
|
|
|
|
win_skip("DirectMusicSegment without IDirectMusicSegment8\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok(hr == S_OK, "DirectMusicSegment create failed: %08x, expected S_OK\n", hr);
|
|
|
|
refcount = IDirectMusicSegment8_AddRef(dms);
|
|
|
|
ok (refcount == 2, "refcount == %u, expected 2\n", refcount);
|
|
|
|
hr = IDirectMusicSegment8_QueryInterface(dms, &IID_IDirectMusicObject, (void**)&dmo);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IDirectMusicObject failed: %08x\n", hr);
|
|
|
|
IDirectMusicSegment8_AddRef(dms);
|
|
|
|
refcount = IDirectMusicSegment8_Release(dms);
|
|
|
|
ok (refcount == 3, "refcount == %u, expected 3\n", refcount);
|
|
|
|
hr = IDirectMusicSegment8_QueryInterface(dms, &IID_IPersistStream, (void**)&stream);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
|
|
|
|
refcount = IDirectMusicSegment8_Release(dms);
|
|
|
|
ok (refcount == 3, "refcount == %u, expected 3\n", refcount);
|
|
|
|
hr = IDirectMusicSegment8_QueryInterface(dms, &IID_IUnknown, (void**)&unk);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
|
|
|
|
refcount = IUnknown_Release(unk);
|
|
|
|
ok (refcount == 3, "refcount == %u, expected 3\n", refcount);
|
|
|
|
refcount = IDirectMusicObject_Release(dmo);
|
|
|
|
ok (refcount == 2, "refcount == %u, expected 2\n", refcount);
|
|
|
|
refcount = IPersistStream_Release(stream);
|
|
|
|
ok (refcount == 1, "refcount == %u, expected 1\n", refcount);
|
|
|
|
refcount = IDirectMusicSegment8_Release(dms);
|
|
|
|
ok (refcount == 0, "refcount == %u, expected 0\n", refcount);
|
|
|
|
}
|
|
|
|
|
2014-01-10 10:44:34 +01:00
|
|
|
static void test_COM_segmentstate(void)
|
|
|
|
{
|
|
|
|
IDirectMusicSegmentState8 *dmss8 = (IDirectMusicSegmentState8*)0xdeadbeef;
|
|
|
|
IUnknown *unk;
|
|
|
|
ULONG refcount;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
/* COM aggregation */
|
2017-04-24 20:19:16 +02:00
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicSegmentState, (IUnknown *)0xdeadbeef, CLSCTX_INPROC_SERVER,
|
2014-01-10 10:44:34 +01:00
|
|
|
&IID_IUnknown, (void**)&dmss8);
|
|
|
|
ok(hr == CLASS_E_NOAGGREGATION,
|
|
|
|
"DirectMusicSegmentState8 create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr);
|
|
|
|
ok(!dmss8, "dmss8 = %p\n", dmss8);
|
|
|
|
|
|
|
|
/* Invalid RIID */
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicSegmentState, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IDirectMusicObject, (void**)&dmss8);
|
|
|
|
ok(hr == E_NOINTERFACE,
|
|
|
|
"DirectMusicSegmentState8 create failed: %08x, expected E_NOINTERFACE\n", hr);
|
|
|
|
|
|
|
|
/* Same refcount for all DirectMusicSegmentState interfaces */
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicSegmentState, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IDirectMusicSegmentState8, (void**)&dmss8);
|
|
|
|
if (hr == E_NOINTERFACE) {
|
|
|
|
win_skip("DirectMusicSegmentState without IDirectMusicSegmentState8\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok(hr == S_OK, "DirectMusicSegmentState8 create failed: %08x, expected S_OK\n", hr);
|
|
|
|
refcount = IDirectMusicSegmentState8_AddRef(dmss8);
|
|
|
|
ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
|
|
|
|
|
|
|
|
hr = IDirectMusicSegmentState8_QueryInterface(dmss8, &IID_IUnknown, (void**)&unk);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
|
|
|
|
refcount = IUnknown_AddRef(unk);
|
|
|
|
ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
|
|
|
|
refcount = IUnknown_Release(unk);
|
|
|
|
|
2014-05-04 18:35:15 +02:00
|
|
|
hr = IDirectMusicSegmentState8_QueryInterface(dmss8, &IID_IUnknown, NULL);
|
|
|
|
ok(hr == E_POINTER, "got %08x\n", hr);
|
|
|
|
|
2014-01-10 10:44:34 +01:00
|
|
|
while (IDirectMusicSegmentState8_Release(dmss8));
|
|
|
|
}
|
|
|
|
|
2014-01-10 10:47:03 +01:00
|
|
|
static void test_COM_track(void)
|
|
|
|
{
|
2015-07-02 11:49:22 +02:00
|
|
|
IDirectMusicTrack *dmt;
|
2014-01-10 10:47:03 +01:00
|
|
|
IDirectMusicTrack8 *dmt8;
|
|
|
|
IPersistStream *ps;
|
|
|
|
IUnknown *unk;
|
|
|
|
ULONG refcount;
|
|
|
|
HRESULT hr;
|
|
|
|
#define X(class) &CLSID_ ## class, #class
|
|
|
|
const struct {
|
|
|
|
REFCLSID clsid;
|
|
|
|
const char *name;
|
2015-07-02 11:49:22 +02:00
|
|
|
BOOL has_dmt8;
|
2014-01-10 10:47:03 +01:00
|
|
|
} class[] = {
|
2015-07-02 11:49:22 +02:00
|
|
|
{ X(DirectMusicLyricsTrack), TRUE },
|
|
|
|
{ X(DirectMusicMarkerTrack), FALSE },
|
|
|
|
{ X(DirectMusicParamControlTrack), TRUE },
|
|
|
|
{ X(DirectMusicSegmentTriggerTrack), TRUE },
|
|
|
|
{ X(DirectMusicSeqTrack), TRUE },
|
|
|
|
{ X(DirectMusicSysExTrack), TRUE },
|
|
|
|
{ X(DirectMusicTempoTrack), TRUE },
|
|
|
|
{ X(DirectMusicTimeSigTrack), FALSE },
|
|
|
|
{ X(DirectMusicWaveTrack), TRUE }
|
2014-01-10 10:47:03 +01:00
|
|
|
};
|
|
|
|
#undef X
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(class); i++) {
|
2015-07-02 11:49:22 +02:00
|
|
|
trace("Testing %s\n", class[i].name);
|
2014-01-10 10:47:03 +01:00
|
|
|
/* COM aggregation */
|
|
|
|
dmt8 = (IDirectMusicTrack8*)0xdeadbeef;
|
2017-04-24 20:19:16 +02:00
|
|
|
hr = CoCreateInstance(class[i].clsid, (IUnknown *)0xdeadbeef, CLSCTX_INPROC_SERVER, &IID_IUnknown,
|
2014-01-10 10:47:03 +01:00
|
|
|
(void**)&dmt8);
|
|
|
|
if (hr == REGDB_E_CLASSNOTREG) {
|
|
|
|
win_skip("%s not registered\n", class[i].name);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
ok(hr == CLASS_E_NOAGGREGATION,
|
|
|
|
"%s create failed: %08x, expected CLASS_E_NOAGGREGATION\n", class[i].name, hr);
|
|
|
|
ok(!dmt8, "dmt8 = %p\n", dmt8);
|
|
|
|
|
|
|
|
/* Invalid RIID */
|
|
|
|
hr = CoCreateInstance(class[i].clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicObject,
|
|
|
|
(void**)&dmt8);
|
|
|
|
ok(hr == E_NOINTERFACE, "%s create failed: %08x, expected E_NOINTERFACE\n",
|
|
|
|
class[i].name, hr);
|
|
|
|
|
|
|
|
/* Same refcount for all DirectMusicTrack interfaces */
|
2015-07-02 11:49:22 +02:00
|
|
|
hr = CoCreateInstance(class[i].clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicTrack,
|
|
|
|
(void**)&dmt);
|
2014-01-10 10:47:03 +01:00
|
|
|
ok(hr == S_OK, "%s create failed: %08x, expected S_OK\n", class[i].name, hr);
|
2015-07-02 11:49:22 +02:00
|
|
|
refcount = IDirectMusicTrack_AddRef(dmt);
|
2014-01-10 10:47:03 +01:00
|
|
|
ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
|
|
|
|
|
2015-07-02 11:49:22 +02:00
|
|
|
hr = IDirectMusicTrack_QueryInterface(dmt, &IID_IPersistStream, (void**)&ps);
|
2014-01-10 10:47:03 +01:00
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
|
|
|
|
refcount = IPersistStream_AddRef(ps);
|
|
|
|
ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
|
2015-01-15 12:09:15 +01:00
|
|
|
IPersistStream_Release(ps);
|
2014-01-10 10:47:03 +01:00
|
|
|
|
2015-07-02 11:49:22 +02:00
|
|
|
hr = IDirectMusicTrack_QueryInterface(dmt, &IID_IUnknown, (void**)&unk);
|
2014-01-10 10:47:03 +01:00
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
|
|
|
|
refcount = IUnknown_AddRef(unk);
|
|
|
|
ok(refcount == 5, "refcount == %u, expected 5\n", refcount);
|
|
|
|
refcount = IUnknown_Release(unk);
|
|
|
|
|
2015-07-02 11:49:22 +02:00
|
|
|
hr = IDirectMusicTrack_QueryInterface(dmt, &IID_IDirectMusicTrack8, (void**)&dmt8);
|
|
|
|
if (class[i].has_dmt8) {
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IDirectMusicTrack8 failed: %08x\n", hr);
|
|
|
|
refcount = IDirectMusicTrack8_AddRef(dmt8);
|
|
|
|
ok(refcount == 6, "refcount == %u, expected 6\n", refcount);
|
|
|
|
refcount = IDirectMusicTrack8_Release(dmt8);
|
|
|
|
} else {
|
|
|
|
ok(hr == E_NOINTERFACE, "QueryInterface for IID_IDirectMusicTrack8 failed: %08x\n", hr);
|
|
|
|
refcount = IDirectMusicTrack_AddRef(dmt);
|
|
|
|
ok(refcount == 5, "refcount == %u, expected 5\n", refcount);
|
|
|
|
}
|
|
|
|
|
|
|
|
while (IDirectMusicTrack_Release(dmt));
|
2014-01-10 10:47:03 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-30 23:08:01 +02:00
|
|
|
static void test_audiopathconfig(void)
|
|
|
|
{
|
|
|
|
IDirectMusicObject *dmo;
|
|
|
|
IPersistStream *ps;
|
|
|
|
CLSID class = { 0 };
|
|
|
|
ULARGE_INTEGER size;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicAudioPathConfig, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IDirectMusicObject, (void**)&dmo);
|
2014-07-27 04:31:42 +02:00
|
|
|
if (hr == REGDB_E_CLASSNOTREG) {
|
|
|
|
win_skip("DirectMusicAudioPathConfig not registered\n");
|
|
|
|
return;
|
|
|
|
}
|
2014-05-30 23:08:01 +02:00
|
|
|
ok(hr == S_OK, "DirectMusicAudioPathConfig create failed: %08x, expected S_OK\n", hr);
|
|
|
|
|
|
|
|
/* IPersistStream */
|
|
|
|
hr = IDirectMusicObject_QueryInterface(dmo, &IID_IPersistStream, (void**)&ps);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
|
|
|
|
hr = IPersistStream_GetClassID(ps, &class);
|
2015-06-15 01:19:37 +02:00
|
|
|
ok(hr == S_OK, "IPersistStream_GetClassID failed: %08x\n", hr);
|
|
|
|
ok(IsEqualGUID(&class, &CLSID_DirectMusicAudioPathConfig),
|
2014-05-30 23:08:01 +02:00
|
|
|
"Expected class CLSID_DirectMusicAudioPathConfig got %s\n", wine_dbgstr_guid(&class));
|
|
|
|
|
|
|
|
/* Unimplemented IPersistStream methods */
|
|
|
|
hr = IPersistStream_IsDirty(ps);
|
2015-06-15 01:19:37 +02:00
|
|
|
ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr);
|
2014-05-30 23:08:01 +02:00
|
|
|
hr = IPersistStream_GetSizeMax(ps, &size);
|
|
|
|
ok(hr == E_NOTIMPL, "IPersistStream_GetSizeMax failed: %08x\n", hr);
|
|
|
|
hr = IPersistStream_Save(ps, NULL, TRUE);
|
|
|
|
ok(hr == E_NOTIMPL, "IPersistStream_Save failed: %08x\n", hr);
|
|
|
|
|
|
|
|
while (IDirectMusicObject_Release(dmo));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_graph(void)
|
|
|
|
{
|
|
|
|
IDirectMusicGraph *dmg;
|
|
|
|
IPersistStream *ps;
|
|
|
|
CLSID class = { 0 };
|
|
|
|
ULARGE_INTEGER size;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicGraph, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IDirectMusicGraph, (void**)&dmg);
|
|
|
|
ok(hr == S_OK, "DirectMusicGraph create failed: %08x, expected S_OK\n", hr);
|
|
|
|
|
|
|
|
/* IPersistStream */
|
|
|
|
hr = IDirectMusicGraph_QueryInterface(dmg, &IID_IPersistStream, (void**)&ps);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
|
|
|
|
hr = IPersistStream_GetClassID(ps, &class);
|
2015-04-26 23:45:00 +02:00
|
|
|
ok(hr == S_OK || broken(hr == E_NOTIMPL) /* win2k */, "IPersistStream_GetClassID failed: %08x\n", hr);
|
|
|
|
if (hr == S_OK)
|
|
|
|
ok(IsEqualGUID(&class, &CLSID_DirectMusicGraph),
|
|
|
|
"Expected class CLSID_DirectMusicGraph got %s\n", wine_dbgstr_guid(&class));
|
2014-05-30 23:08:01 +02:00
|
|
|
|
|
|
|
/* Unimplemented IPersistStream methods */
|
|
|
|
hr = IPersistStream_IsDirty(ps);
|
2015-06-15 01:22:26 +02:00
|
|
|
ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr);
|
2014-05-30 23:08:01 +02:00
|
|
|
hr = IPersistStream_GetSizeMax(ps, &size);
|
|
|
|
ok(hr == E_NOTIMPL, "IPersistStream_GetSizeMax failed: %08x\n", hr);
|
|
|
|
hr = IPersistStream_Save(ps, NULL, TRUE);
|
|
|
|
ok(hr == E_NOTIMPL, "IPersistStream_Save failed: %08x\n", hr);
|
|
|
|
|
|
|
|
while (IDirectMusicGraph_Release(dmg));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_segment(void)
|
|
|
|
{
|
|
|
|
IDirectMusicSegment *dms;
|
|
|
|
IPersistStream *ps;
|
|
|
|
CLSID class = { 0 };
|
|
|
|
ULARGE_INTEGER size;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicSegment, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IDirectMusicSegment, (void**)&dms);
|
|
|
|
ok(hr == S_OK, "DirectMusicSegment create failed: %08x, expected S_OK\n", hr);
|
|
|
|
|
|
|
|
/* IPersistStream */
|
|
|
|
hr = IDirectMusicSegment_QueryInterface(dms, &IID_IPersistStream, (void**)&ps);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
|
|
|
|
hr = IPersistStream_GetClassID(ps, &class);
|
2015-04-26 23:45:00 +02:00
|
|
|
ok(hr == S_OK || broken(hr == E_NOTIMPL) /* win2k */, "IPersistStream_GetClassID failed: %08x\n", hr);
|
|
|
|
if (hr == S_OK)
|
|
|
|
ok(IsEqualGUID(&class, &CLSID_DirectMusicSegment),
|
|
|
|
"Expected class CLSID_DirectMusicSegment got %s\n", wine_dbgstr_guid(&class));
|
2014-05-30 23:08:01 +02:00
|
|
|
|
|
|
|
/* Unimplemented IPersistStream methods */
|
|
|
|
hr = IPersistStream_IsDirty(ps);
|
|
|
|
ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr);
|
|
|
|
hr = IPersistStream_GetSizeMax(ps, &size);
|
|
|
|
ok(hr == E_NOTIMPL, "IPersistStream_GetSizeMax failed: %08x\n", hr);
|
|
|
|
hr = IPersistStream_Save(ps, NULL, TRUE);
|
|
|
|
ok(hr == E_NOTIMPL, "IPersistStream_Save failed: %08x\n", hr);
|
|
|
|
|
|
|
|
while (IDirectMusicSegment_Release(dms));
|
|
|
|
}
|
|
|
|
|
2019-11-27 00:49:54 +01:00
|
|
|
static void _add_track(IDirectMusicSegment8 *seg, REFCLSID class, const char *name, DWORD group)
|
|
|
|
{
|
|
|
|
IDirectMusicTrack *track;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(class, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicTrack,
|
|
|
|
(void**)&track);
|
|
|
|
ok(hr == S_OK, "%s create failed: %08x, expected S_OK\n", name, hr);
|
|
|
|
hr = IDirectMusicSegment8_InsertTrack(seg, track, group);
|
|
|
|
if (group)
|
|
|
|
ok(hr == S_OK, "Inserting %s failed: %08x, expected S_OK\n", name, hr);
|
|
|
|
else
|
|
|
|
ok(hr == E_INVALIDARG, "Inserting %s failed: %08x, expected E_INVALIDARG\n", name, hr);
|
|
|
|
IDirectMusicTrack_Release(track);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define add_track(seg, class, group) _add_track(seg, &CLSID_DirectMusic ## class, #class, group)
|
|
|
|
|
|
|
|
static void _expect_track(IDirectMusicSegment8 *seg, REFCLSID expect, const char *name, DWORD group,
|
2019-12-08 18:53:51 +01:00
|
|
|
DWORD index, BOOL ignore_guid)
|
2019-11-27 00:49:54 +01:00
|
|
|
{
|
|
|
|
IDirectMusicTrack *track;
|
|
|
|
IPersistStream *ps;
|
|
|
|
CLSID class;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2019-12-08 18:53:51 +01:00
|
|
|
if (ignore_guid)
|
|
|
|
hr = IDirectMusicSegment8_GetTrack(seg, &GUID_NULL, group, index, &track);
|
|
|
|
else
|
|
|
|
hr = IDirectMusicSegment8_GetTrack(seg, expect, group, index, &track);
|
2019-11-27 00:49:54 +01:00
|
|
|
if (!expect) {
|
|
|
|
ok(hr == DMUS_E_NOT_FOUND, "GetTrack failed: %08x, expected DMUS_E_NOT_FOUND\n", hr);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ok(hr == S_OK, "GetTrack failed: %08x, expected S_OK\n", hr);
|
|
|
|
hr = IDirectMusicTrack_QueryInterface(track, &IID_IPersistStream, (void**)&ps);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
|
|
|
|
hr = IPersistStream_GetClassID(ps, &class);
|
|
|
|
ok(hr == S_OK, "IPersistStream_GetClassID failed: %08x\n", hr);
|
|
|
|
ok(IsEqualGUID(&class, expect), "For group %#x index %u: Expected class %s got %s\n",
|
|
|
|
group, index, name, wine_dbgstr_guid(&class));
|
|
|
|
|
|
|
|
IPersistStream_Release(ps);
|
|
|
|
IDirectMusicTrack_Release(track);
|
|
|
|
}
|
|
|
|
|
2019-12-08 18:53:51 +01:00
|
|
|
#define expect_track(seg, class, group, index) \
|
|
|
|
_expect_track(seg, &CLSID_DirectMusic ## class, #class, group, index, TRUE)
|
|
|
|
#define expect_guid_track(seg, class, group, index) \
|
|
|
|
_expect_track(seg, &CLSID_DirectMusic ## class, #class, group, index, FALSE)
|
2019-11-27 00:49:54 +01:00
|
|
|
|
2019-12-08 18:53:51 +01:00
|
|
|
static void test_gettrack(void)
|
2019-11-27 00:49:54 +01:00
|
|
|
{
|
|
|
|
IDirectMusicSegment8 *seg;
|
|
|
|
IDirectMusicTrack *track;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicSegment, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IDirectMusicSegment8, (void**)&seg);
|
|
|
|
ok(hr == S_OK, "DirectMusicSegment create failed: %08x, expected S_OK\n", hr);
|
|
|
|
|
|
|
|
add_track(seg, LyricsTrack, 0x0); /* failure */
|
|
|
|
add_track(seg, LyricsTrack, 0x1); /* idx 0 group 1 */
|
|
|
|
add_track(seg, ParamControlTrack, 0x3); /* idx 1 group 1, idx 0 group 2 */
|
|
|
|
add_track(seg, SegmentTriggerTrack, 0x2); /* idx 1 group 2 */
|
|
|
|
add_track(seg, SeqTrack, 0x1); /* idx 2 group 1 */
|
|
|
|
add_track(seg, TempoTrack, 0x7); /* idx 3 group 1, idx 2 group 2, idx 0 group 3 */
|
2019-12-08 18:53:51 +01:00
|
|
|
add_track(seg, WaveTrack, 0xffffffff); /* idx 4 group 1, idx 3 group 2, idx 1 group 3 */
|
2019-11-27 00:49:54 +01:00
|
|
|
|
2019-12-08 18:53:51 +01:00
|
|
|
/* Ignore GUID in GetTrack */
|
2019-11-27 00:49:54 +01:00
|
|
|
hr = IDirectMusicSegment8_GetTrack(seg, &GUID_NULL, 0, 0, &track);
|
|
|
|
ok(hr == DMUS_E_NOT_FOUND, "GetTrack failed: %08x, expected DMUS_E_NOT_FOUND\n", hr);
|
|
|
|
|
|
|
|
expect_track(seg, LyricsTrack, 0x1, 0);
|
|
|
|
expect_track(seg, ParamControlTrack, 0x1, 1);
|
|
|
|
expect_track(seg, SeqTrack, 0x1, 2);
|
|
|
|
expect_track(seg, TempoTrack, 0x1, 3);
|
2019-12-08 18:53:51 +01:00
|
|
|
expect_track(seg, WaveTrack, 0x1, 4);
|
|
|
|
_expect_track(seg, NULL, "", 0x1, 5, TRUE);
|
|
|
|
_expect_track(seg, NULL, "", 0x1, DMUS_SEG_ANYTRACK, TRUE);
|
2019-11-27 00:49:54 +01:00
|
|
|
expect_track(seg, ParamControlTrack, 0x2, 0);
|
2019-12-08 18:53:51 +01:00
|
|
|
expect_track(seg, WaveTrack, 0x80000000, 0);
|
2019-11-27 00:49:54 +01:00
|
|
|
expect_track(seg, SegmentTriggerTrack, 0x3, 2); /* groups 1+2 combined index */
|
|
|
|
expect_track(seg, SeqTrack, 0x3, 3); /* groups 1+2 combined index */
|
|
|
|
expect_track(seg, TempoTrack, 0x7, 4); /* groups 1+2+3 combined index */
|
|
|
|
expect_track(seg, TempoTrack, 0xffffffff, 4); /* all groups combined index */
|
2019-12-08 18:53:51 +01:00
|
|
|
_expect_track(seg, NULL, "", 0xffffffff, DMUS_SEG_ANYTRACK, TRUE);
|
|
|
|
|
|
|
|
/* Use the GUID in GetTrack */
|
|
|
|
hr = IDirectMusicSegment8_GetTrack(seg, &CLSID_DirectMusicLyricsTrack, 0, 0, &track);
|
|
|
|
ok(hr == DMUS_E_NOT_FOUND, "GetTrack failed: %08x, expected DMUS_E_NOT_FOUND\n", hr);
|
|
|
|
|
|
|
|
expect_guid_track(seg, LyricsTrack, 0x1, 0);
|
|
|
|
expect_guid_track(seg, ParamControlTrack, 0x1, 0);
|
|
|
|
expect_guid_track(seg, SeqTrack, 0x1, 0);
|
|
|
|
expect_guid_track(seg, TempoTrack, 0x1, 0);
|
|
|
|
expect_guid_track(seg, ParamControlTrack, 0x2, 0);
|
|
|
|
expect_guid_track(seg, SegmentTriggerTrack, 0x3, 0);
|
|
|
|
expect_guid_track(seg, SeqTrack, 0x3, 0);
|
|
|
|
expect_guid_track(seg, TempoTrack, 0x7, 0);
|
|
|
|
expect_guid_track(seg, TempoTrack, 0xffffffff, 0);
|
2019-11-27 00:49:54 +01:00
|
|
|
|
|
|
|
IDirectMusicSegment8_Release(seg);
|
|
|
|
}
|
|
|
|
|
2019-12-08 18:53:53 +01:00
|
|
|
static void test_segment_param(void)
|
|
|
|
{
|
|
|
|
IDirectMusicSegment8 *seg;
|
|
|
|
char buf[64];
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicSegment, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IDirectMusicSegment8, (void **)&seg);
|
|
|
|
ok(hr == S_OK, "DirectMusicSegment create failed: %08x, expected S_OK\n", hr);
|
|
|
|
|
|
|
|
add_track(seg, LyricsTrack, 0x1); /* no params */
|
|
|
|
add_track(seg, SegmentTriggerTrack, 0x1); /* all params "supported" */
|
|
|
|
|
|
|
|
hr = IDirectMusicSegment8_GetParam(seg, NULL, 0x1, 0, 0, NULL, buf);
|
|
|
|
ok(hr == E_POINTER, "GetParam failed: %08x, expected E_POINTER\n", hr);
|
|
|
|
hr = IDirectMusicSegment8_SetParam(seg, NULL, 0x1, 0, 0, buf);
|
|
|
|
todo_wine ok(hr == E_POINTER, "SetParam failed: %08x, expected E_POINTER\n", hr);
|
|
|
|
|
|
|
|
hr = IDirectMusicSegment8_GetParam(seg, &GUID_Valid_Start_Time, 0x1, 0, 0, NULL, buf);
|
|
|
|
ok(hr == DMUS_E_GET_UNSUPPORTED,
|
|
|
|
"GetParam failed: %08x, expected DMUS_E_GET_UNSUPPORTED\n", hr);
|
|
|
|
hr = IDirectMusicSegment8_GetParam(seg, &GUID_Valid_Start_Time, 0x1, 1, 0, NULL, buf);
|
|
|
|
ok(hr == DMUS_E_TRACK_NOT_FOUND,
|
|
|
|
"GetParam failed: %08x, expected DMUS_E_TRACK_NOT_FOUND\n", hr);
|
|
|
|
hr = IDirectMusicSegment8_GetParam(seg, &GUID_Valid_Start_Time, 0x1, DMUS_SEG_ANYTRACK, 0,
|
|
|
|
NULL, buf);
|
|
|
|
ok(hr == DMUS_E_GET_UNSUPPORTED,
|
|
|
|
"GetParam failed: %08x, expected DMUS_E_GET_UNSUPPORTED\n", hr);
|
|
|
|
|
|
|
|
hr = IDirectMusicSegment8_SetParam(seg, &GUID_Valid_Start_Time, 0x1, 0, 0, buf);
|
|
|
|
ok(hr == S_OK, "SetParam failed: %08x, expected S_OK\n", hr);
|
|
|
|
hr = IDirectMusicSegment8_SetParam(seg, &GUID_Valid_Start_Time, 0x1, 1, 0, buf);
|
|
|
|
todo_wine ok(hr == DMUS_E_TRACK_NOT_FOUND,
|
|
|
|
"SetParam failed: %08x, expected DMUS_E_TRACK_NOT_FOUND\n", hr);
|
|
|
|
hr = IDirectMusicSegment8_SetParam(seg, &GUID_Valid_Start_Time, 0x1, DMUS_SEG_ALLTRACKS,
|
|
|
|
0, buf);
|
|
|
|
ok(hr == S_OK, "SetParam failed: %08x, expected S_OK\n", hr);
|
|
|
|
|
|
|
|
IDirectMusicSegment8_Release(seg);
|
|
|
|
}
|
|
|
|
|
2019-12-03 23:51:20 +01:00
|
|
|
static void expect_getparam(IDirectMusicTrack *track, REFGUID type, const char *name,
|
|
|
|
HRESULT expect)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
char buf[64] = { 0 };
|
|
|
|
|
|
|
|
hr = IDirectMusicTrack8_GetParam(track, type, 0, NULL, buf);
|
|
|
|
ok(hr == expect, "GetParam(%s) failed: %08x, expected %08x\n", name, hr, expect);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void expect_setparam(IDirectMusicTrack *track, REFGUID type, const char *name,
|
|
|
|
HRESULT expect)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
char buf[64] = { 0 };
|
|
|
|
|
|
|
|
hr = IDirectMusicTrack8_SetParam(track, type, 0, buf);
|
|
|
|
ok(hr == expect, "SetParam(%s) failed: %08x, expected %08x\n", name, hr, expect);
|
|
|
|
}
|
|
|
|
|
2015-06-16 09:26:41 +02:00
|
|
|
static void test_track(void)
|
|
|
|
{
|
2015-07-02 11:49:22 +02:00
|
|
|
IDirectMusicTrack *dmt;
|
2015-07-06 00:05:56 +02:00
|
|
|
IDirectMusicTrack8 *dmt8;
|
2015-06-16 09:26:41 +02:00
|
|
|
IPersistStream *ps;
|
|
|
|
CLSID classid;
|
|
|
|
ULARGE_INTEGER size;
|
|
|
|
HRESULT hr;
|
2019-11-18 00:57:19 +01:00
|
|
|
#define X(guid) &guid, #guid
|
|
|
|
const struct {
|
|
|
|
REFGUID type;
|
|
|
|
const char *name;
|
|
|
|
} param_types[] = {
|
|
|
|
{ X(GUID_BandParam) },
|
|
|
|
{ X(GUID_ChordParam) },
|
|
|
|
{ X(GUID_Clear_All_Bands) },
|
|
|
|
{ X(GUID_CommandParam) },
|
|
|
|
{ X(GUID_CommandParam2) },
|
|
|
|
{ X(GUID_CommandParamNext) },
|
|
|
|
{ X(GUID_ConnectToDLSCollection) },
|
|
|
|
{ X(GUID_Disable_Auto_Download) },
|
|
|
|
{ X(GUID_DisableTempo) },
|
|
|
|
{ X(GUID_DisableTimeSig) },
|
|
|
|
{ X(GUID_Download) },
|
|
|
|
{ X(GUID_DownloadToAudioPath) },
|
|
|
|
{ X(GUID_Enable_Auto_Download) },
|
|
|
|
{ X(GUID_EnableTempo) },
|
|
|
|
{ X(GUID_EnableTimeSig) },
|
|
|
|
{ X(GUID_IDirectMusicBand) },
|
|
|
|
{ X(GUID_IDirectMusicChordMap) },
|
|
|
|
{ X(GUID_IDirectMusicStyle) },
|
|
|
|
{ X(GUID_MuteParam) },
|
|
|
|
{ X(GUID_Play_Marker) },
|
|
|
|
{ X(GUID_RhythmParam) },
|
|
|
|
{ X(GUID_SeedVariations) },
|
|
|
|
{ X(GUID_StandardMIDIFile) },
|
|
|
|
{ X(GUID_TempoParam) },
|
|
|
|
{ X(GUID_TimeSignature) },
|
|
|
|
{ X(GUID_Unload) },
|
|
|
|
{ X(GUID_UnloadFromAudioPath) },
|
|
|
|
{ X(GUID_Valid_Start_Time) },
|
|
|
|
{ X(GUID_Variations) },
|
|
|
|
{ X(GUID_NULL) }
|
|
|
|
};
|
|
|
|
#undef X
|
2015-06-16 09:26:41 +02:00
|
|
|
#define X(class) &CLSID_ ## class, #class
|
|
|
|
const struct {
|
|
|
|
REFCLSID clsid;
|
|
|
|
const char *name;
|
2019-11-18 00:57:19 +01:00
|
|
|
/* bitfield with supported param types */
|
|
|
|
unsigned int has_params;
|
2015-06-16 09:26:41 +02:00
|
|
|
} class[] = {
|
2019-11-18 00:57:19 +01:00
|
|
|
{ X(DirectMusicLyricsTrack), 0 },
|
|
|
|
{ X(DirectMusicMarkerTrack), 0x8080000 },
|
|
|
|
{ X(DirectMusicParamControlTrack), 0 },
|
|
|
|
{ X(DirectMusicSegmentTriggerTrack), 0x3fffffff },
|
|
|
|
{ X(DirectMusicSeqTrack), ~0 }, /* param methods not implemented */
|
|
|
|
{ X(DirectMusicSysExTrack), ~0 }, /* param methods not implemented */
|
|
|
|
{ X(DirectMusicTempoTrack), 0x802100 },
|
|
|
|
{ X(DirectMusicTimeSigTrack), 0x1004200 },
|
|
|
|
{ X(DirectMusicWaveTrack), 0x6001c80 }
|
2015-06-16 09:26:41 +02:00
|
|
|
};
|
|
|
|
#undef X
|
2019-11-18 00:57:19 +01:00
|
|
|
unsigned int i, j;
|
2015-06-16 09:26:41 +02:00
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(class); i++) {
|
|
|
|
trace("Testing %s\n", class[i].name);
|
2015-07-02 11:49:22 +02:00
|
|
|
hr = CoCreateInstance(class[i].clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicTrack,
|
|
|
|
(void**)&dmt);
|
2015-06-16 09:26:41 +02:00
|
|
|
ok(hr == S_OK, "%s create failed: %08x, expected S_OK\n", class[i].name, hr);
|
|
|
|
|
2015-07-06 00:05:56 +02:00
|
|
|
/* IDirectMusicTrack */
|
2019-11-18 00:57:19 +01:00
|
|
|
if (class[i].has_params != ~0) {
|
|
|
|
for (j = 0; j < ARRAY_SIZE(param_types); j++) {
|
|
|
|
hr = IDirectMusicTrack8_IsParamSupported(dmt, param_types[j].type);
|
2019-12-03 23:51:20 +01:00
|
|
|
if (class[i].has_params & (1 << j)) {
|
2019-11-18 00:57:19 +01:00
|
|
|
ok(hr == S_OK, "IsParamSupported(%s) failed: %08x, expected S_OK\n",
|
|
|
|
param_types[j].name, hr);
|
2019-12-03 23:51:20 +01:00
|
|
|
if (class[i].clsid == &CLSID_DirectMusicSegmentTriggerTrack) {
|
|
|
|
expect_getparam(dmt, param_types[j].type, param_types[j].name,
|
|
|
|
DMUS_E_GET_UNSUPPORTED);
|
|
|
|
expect_setparam(dmt, param_types[j].type, param_types[j].name, S_OK);
|
2019-12-03 23:51:21 +01:00
|
|
|
} else if (class[i].clsid == &CLSID_DirectMusicMarkerTrack)
|
|
|
|
expect_setparam(dmt, param_types[j].type, param_types[j].name,
|
|
|
|
DMUS_E_SET_UNSUPPORTED);
|
2019-12-03 23:51:22 +01:00
|
|
|
else if (class[i].clsid == &CLSID_DirectMusicWaveTrack)
|
|
|
|
expect_getparam(dmt, param_types[j].type, param_types[j].name,
|
|
|
|
DMUS_E_GET_UNSUPPORTED);
|
2019-12-03 23:51:26 +01:00
|
|
|
} else {
|
2019-11-18 00:57:19 +01:00
|
|
|
ok(hr == DMUS_E_TYPE_UNSUPPORTED,
|
|
|
|
"IsParamSupported(%s) failed: %08x, expected DMUS_E_TYPE_UNSUPPORTED\n",
|
|
|
|
param_types[j].name, hr);
|
2019-12-03 23:51:26 +01:00
|
|
|
expect_getparam(dmt, param_types[j].type, param_types[j].name,
|
|
|
|
DMUS_E_GET_UNSUPPORTED);
|
|
|
|
if (class[i].clsid == &CLSID_DirectMusicWaveTrack)
|
|
|
|
expect_setparam(dmt, param_types[j].type, param_types[j].name,
|
|
|
|
DMUS_E_TYPE_UNSUPPORTED);
|
|
|
|
else
|
|
|
|
expect_setparam(dmt, param_types[j].type, param_types[j].name,
|
|
|
|
DMUS_E_SET_UNSUPPORTED);
|
|
|
|
}
|
|
|
|
|
2019-12-03 23:51:23 +01:00
|
|
|
/* GetParam / SetParam for IsParamSupported supported types */
|
|
|
|
if (class[i].clsid == &CLSID_DirectMusicTimeSigTrack) {
|
|
|
|
expect_getparam(dmt, &GUID_DisableTimeSig, "GUID_DisableTimeSig",
|
|
|
|
DMUS_E_GET_UNSUPPORTED);
|
|
|
|
expect_getparam(dmt, &GUID_EnableTimeSig, "GUID_EnableTimeSig",
|
|
|
|
DMUS_E_GET_UNSUPPORTED);
|
|
|
|
expect_setparam(dmt, &GUID_TimeSignature, "GUID_TimeSignature",
|
|
|
|
DMUS_E_SET_UNSUPPORTED);
|
2019-12-03 23:51:25 +01:00
|
|
|
} else if (class[i].clsid == &CLSID_DirectMusicTempoTrack) {
|
|
|
|
expect_getparam(dmt, &GUID_DisableTempo, "GUID_DisableTempo",
|
|
|
|
DMUS_E_GET_UNSUPPORTED);
|
|
|
|
expect_getparam(dmt, &GUID_EnableTempo, "GUID_EnableTempo",
|
|
|
|
DMUS_E_GET_UNSUPPORTED);
|
2019-12-03 23:51:23 +01:00
|
|
|
}
|
2019-11-18 00:57:19 +01:00
|
|
|
}
|
|
|
|
} else {
|
2015-07-06 00:05:56 +02:00
|
|
|
hr = IDirectMusicTrack_GetParam(dmt, NULL, 0, NULL, NULL);
|
|
|
|
ok(hr == E_NOTIMPL, "IDirectMusicTrack_GetParam failed: %08x\n", hr);
|
|
|
|
hr = IDirectMusicTrack_SetParam(dmt, NULL, 0, NULL);
|
|
|
|
ok(hr == E_NOTIMPL, "IDirectMusicTrack_SetParam failed: %08x\n", hr);
|
|
|
|
hr = IDirectMusicTrack_IsParamSupported(dmt, NULL);
|
|
|
|
ok(hr == E_NOTIMPL, "IDirectMusicTrack_IsParamSupported failed: %08x\n", hr);
|
2019-11-14 20:40:24 +01:00
|
|
|
|
|
|
|
hr = IDirectMusicTrack_IsParamSupported(dmt, &GUID_IDirectMusicStyle);
|
|
|
|
ok(hr == E_NOTIMPL, "got: %08x\n", hr);
|
|
|
|
}
|
2015-07-06 00:05:56 +02:00
|
|
|
if (class[i].clsid != &CLSID_DirectMusicMarkerTrack &&
|
|
|
|
class[i].clsid != &CLSID_DirectMusicTimeSigTrack) {
|
|
|
|
hr = IDirectMusicTrack_AddNotificationType(dmt, NULL);
|
|
|
|
ok(hr == E_NOTIMPL, "IDirectMusicTrack_AddNotificationType failed: %08x\n", hr);
|
|
|
|
hr = IDirectMusicTrack_RemoveNotificationType(dmt, NULL);
|
|
|
|
ok(hr == E_NOTIMPL, "IDirectMusicTrack_RemoveNotificationType failed: %08x\n", hr);
|
|
|
|
}
|
|
|
|
hr = IDirectMusicTrack_Clone(dmt, 0, 0, NULL);
|
|
|
|
todo_wine ok(hr == E_POINTER, "IDirectMusicTrack_Clone failed: %08x\n", hr);
|
|
|
|
|
|
|
|
/* IDirectMusicTrack8 */
|
|
|
|
hr = IDirectMusicTrack_QueryInterface(dmt, &IID_IDirectMusicTrack8, (void**)&dmt8);
|
|
|
|
if (hr == S_OK) {
|
|
|
|
hr = IDirectMusicTrack8_PlayEx(dmt8, NULL, 0, 0, 0, 0, NULL, NULL, 0);
|
|
|
|
todo_wine ok(hr == E_POINTER, "IDirectMusicTrack8_PlayEx failed: %08x\n", hr);
|
2019-11-18 00:57:19 +01:00
|
|
|
if (class[i].has_params == ~0) {
|
2015-07-06 00:05:56 +02:00
|
|
|
hr = IDirectMusicTrack8_GetParamEx(dmt8, NULL, 0, NULL, NULL, NULL, 0);
|
|
|
|
ok(hr == E_NOTIMPL, "IDirectMusicTrack8_GetParamEx failed: %08x\n", hr);
|
|
|
|
hr = IDirectMusicTrack8_SetParamEx(dmt8, NULL, 0, NULL, NULL, 0);
|
|
|
|
ok(hr == E_NOTIMPL, "IDirectMusicTrack8_SetParamEx failed: %08x\n", hr);
|
|
|
|
}
|
|
|
|
hr = IDirectMusicTrack8_Compose(dmt8, NULL, 0, NULL);
|
|
|
|
ok(hr == E_NOTIMPL, "IDirectMusicTrack8_Compose failed: %08x\n", hr);
|
|
|
|
hr = IDirectMusicTrack8_Join(dmt8, NULL, 0, NULL, 0, NULL);
|
|
|
|
if (class[i].clsid == &CLSID_DirectMusicTempoTrack)
|
|
|
|
todo_wine ok(hr == E_POINTER, "IDirectMusicTrack8_Join failed: %08x\n", hr);
|
|
|
|
else
|
|
|
|
ok(hr == E_NOTIMPL, "IDirectMusicTrack8_Join failed: %08x\n", hr);
|
|
|
|
IDirectMusicTrack8_Release(dmt8);
|
|
|
|
}
|
|
|
|
|
2015-06-16 09:26:41 +02:00
|
|
|
/* IPersistStream */
|
2015-07-02 11:49:22 +02:00
|
|
|
hr = IDirectMusicTrack_QueryInterface(dmt, &IID_IPersistStream, (void**)&ps);
|
2015-06-16 09:26:41 +02:00
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
|
|
|
|
hr = IPersistStream_GetClassID(ps, &classid);
|
2015-07-03 10:40:53 +02:00
|
|
|
ok(hr == S_OK, "IPersistStream_GetClassID failed: %08x\n", hr);
|
|
|
|
ok(IsEqualGUID(&classid, class[i].clsid),
|
|
|
|
"Expected class %s got %s\n", class[i].name, wine_dbgstr_guid(&classid));
|
|
|
|
hr = IPersistStream_IsDirty(ps);
|
|
|
|
ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr);
|
2015-06-16 09:26:41 +02:00
|
|
|
|
|
|
|
/* Unimplemented IPersistStream methods */
|
|
|
|
hr = IPersistStream_GetSizeMax(ps, &size);
|
|
|
|
ok(hr == E_NOTIMPL, "IPersistStream_GetSizeMax failed: %08x\n", hr);
|
|
|
|
hr = IPersistStream_Save(ps, NULL, TRUE);
|
|
|
|
ok(hr == E_NOTIMPL, "IPersistStream_Save failed: %08x\n", hr);
|
|
|
|
|
2015-07-02 11:49:22 +02:00
|
|
|
while (IDirectMusicTrack_Release(dmt));
|
2015-06-16 09:26:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-02 01:16:08 +01:00
|
|
|
struct chunk {
|
|
|
|
FOURCC id;
|
|
|
|
DWORD size;
|
|
|
|
FOURCC type;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define CHUNK_HDR_SIZE (sizeof(FOURCC) + sizeof(DWORD))
|
|
|
|
|
|
|
|
/* Generate a RIFF file format stream from an array of FOURCC ids.
|
|
|
|
RIFF and LIST need to be followed by the form type respectively list type,
|
|
|
|
followed by the chunks of the list and terminated with 0. */
|
|
|
|
static IStream *gen_riff_stream(const FOURCC *ids)
|
|
|
|
{
|
|
|
|
static const LARGE_INTEGER zero;
|
|
|
|
int level = -1;
|
|
|
|
DWORD *sizes[4]; /* Stack for the sizes of RIFF and LIST chunks */
|
|
|
|
char riff[1024];
|
|
|
|
char *p = riff;
|
|
|
|
struct chunk *ck;
|
|
|
|
IStream *stream;
|
|
|
|
|
|
|
|
do {
|
|
|
|
ck = (struct chunk *)p;
|
|
|
|
ck->id = *ids++;
|
|
|
|
switch (ck->id) {
|
|
|
|
case 0:
|
|
|
|
*sizes[level] = p - (char *)sizes[level] - sizeof(DWORD);
|
|
|
|
level--;
|
|
|
|
break;
|
|
|
|
case FOURCC_LIST:
|
|
|
|
case FOURCC_RIFF:
|
|
|
|
level++;
|
|
|
|
sizes[level] = &ck->size;
|
|
|
|
ck->type = *ids++;
|
|
|
|
p += sizeof(*ck);
|
|
|
|
break;
|
|
|
|
case DMUS_FOURCC_GUID_CHUNK:
|
|
|
|
ck->size = sizeof(GUID_NULL);
|
|
|
|
p += CHUNK_HDR_SIZE;
|
|
|
|
memcpy(p, &GUID_NULL, sizeof(GUID_NULL));
|
|
|
|
p += ck->size;
|
|
|
|
break;
|
|
|
|
case DMUS_FOURCC_VERSION_CHUNK:
|
|
|
|
{
|
|
|
|
DMUS_VERSION ver = {5, 8};
|
|
|
|
|
|
|
|
ck->size = sizeof(ver);
|
|
|
|
p += CHUNK_HDR_SIZE;
|
|
|
|
memcpy(p, &ver, sizeof(ver));
|
|
|
|
p += ck->size;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
/* Just convert the FOURCC id to a WCHAR string */
|
|
|
|
WCHAR *s;
|
|
|
|
|
|
|
|
ck->size = 5 * sizeof(WCHAR);
|
|
|
|
p += CHUNK_HDR_SIZE;
|
|
|
|
s = (WCHAR *)p;
|
|
|
|
s[0] = (char)(ck->id);
|
|
|
|
s[1] = (char)(ck->id >> 8);
|
|
|
|
s[2] = (char)(ck->id >> 16);
|
|
|
|
s[3] = (char)(ck->id >> 24);
|
|
|
|
s[4] = 0;
|
|
|
|
p += ck->size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while (level >= 0);
|
|
|
|
|
|
|
|
ck = (struct chunk *)riff;
|
|
|
|
CreateStreamOnHGlobal(NULL, TRUE, &stream);
|
|
|
|
IStream_Write(stream, riff, ck->size + CHUNK_HDR_SIZE, NULL);
|
|
|
|
IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
|
|
|
|
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_parsedescriptor(void)
|
|
|
|
{
|
|
|
|
IDirectMusicObject *dmo;
|
|
|
|
IStream *stream;
|
|
|
|
DMUS_OBJECTDESC desc;
|
|
|
|
HRESULT hr;
|
|
|
|
DWORD valid;
|
|
|
|
unsigned int i;
|
|
|
|
/* fourcc ~0 will be replaced later on */
|
|
|
|
FOURCC alldesc[] =
|
|
|
|
{
|
|
|
|
FOURCC_RIFF, ~0, DMUS_FOURCC_CATEGORY_CHUNK, FOURCC_LIST, DMUS_FOURCC_UNFO_LIST,
|
|
|
|
DMUS_FOURCC_UNAM_CHUNK, DMUS_FOURCC_UCOP_CHUNK, DMUS_FOURCC_UCMT_CHUNK,
|
|
|
|
DMUS_FOURCC_USBJ_CHUNK, 0, DMUS_FOURCC_VERSION_CHUNK, DMUS_FOURCC_GUID_CHUNK, 0
|
|
|
|
};
|
|
|
|
FOURCC dupes[] =
|
|
|
|
{
|
|
|
|
FOURCC_RIFF, ~0, DMUS_FOURCC_CATEGORY_CHUNK, DMUS_FOURCC_CATEGORY_CHUNK,
|
|
|
|
DMUS_FOURCC_VERSION_CHUNK, DMUS_FOURCC_VERSION_CHUNK, DMUS_FOURCC_GUID_CHUNK,
|
|
|
|
DMUS_FOURCC_GUID_CHUNK, FOURCC_LIST, DMUS_FOURCC_UNFO_LIST, DMUS_FOURCC_UNAM_CHUNK, 0,
|
|
|
|
FOURCC_LIST, DMUS_FOURCC_UNFO_LIST, mmioFOURCC('I','N','A','M'), 0, 0
|
|
|
|
};
|
|
|
|
FOURCC empty[] = {FOURCC_RIFF, ~0, 0};
|
|
|
|
FOURCC inam[] = {FOURCC_RIFF, ~0, FOURCC_LIST, ~0, mmioFOURCC('I','N','A','M'), 0, 0};
|
2018-03-15 00:09:33 +01:00
|
|
|
FOURCC noriff[] = {mmioFOURCC('J','U','N','K'), 0};
|
2018-03-06 01:07:25 +01:00
|
|
|
#define X(class) &CLSID_ ## class, #class
|
|
|
|
#define Y(form) form, #form
|
2018-03-02 01:16:08 +01:00
|
|
|
const struct {
|
2018-03-06 01:07:25 +01:00
|
|
|
REFCLSID clsid;
|
|
|
|
const char *class;
|
2018-03-02 01:16:08 +01:00
|
|
|
FOURCC form;
|
|
|
|
const char *name;
|
2018-03-06 01:07:25 +01:00
|
|
|
BOOL needs_size;
|
2018-03-02 01:16:08 +01:00
|
|
|
} forms[] = {
|
2018-03-06 01:07:25 +01:00
|
|
|
{ X(DirectMusicSegment), Y(DMUS_FOURCC_SEGMENT_FORM), FALSE },
|
|
|
|
{ X(DirectMusicSegment), Y(mmioFOURCC('W','A','V','E')), FALSE },
|
|
|
|
{ X(DirectMusicAudioPathConfig), Y(DMUS_FOURCC_AUDIOPATH_FORM), TRUE },
|
|
|
|
{ X(DirectMusicGraph), Y(DMUS_FOURCC_TOOLGRAPH_FORM), TRUE },
|
2018-03-02 01:16:08 +01:00
|
|
|
};
|
|
|
|
#undef X
|
2018-03-06 01:07:25 +01:00
|
|
|
#undef Y
|
2018-03-02 01:16:08 +01:00
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(forms); i++) {
|
2018-03-06 01:07:25 +01:00
|
|
|
trace("Testing %s / %s\n", forms[i].class, forms[i].name);
|
|
|
|
hr = CoCreateInstance(forms[i].clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicObject,
|
|
|
|
(void **)&dmo);
|
|
|
|
if (hr != S_OK) {
|
|
|
|
win_skip("Could not create %s object: %08x\n", forms[i].class, hr);
|
|
|
|
return;
|
|
|
|
}
|
2018-03-02 01:16:08 +01:00
|
|
|
|
|
|
|
/* Nothing loaded */
|
|
|
|
memset(&desc, 0, sizeof(desc));
|
|
|
|
hr = IDirectMusicObject_GetDescriptor(dmo, &desc);
|
2018-03-06 01:07:25 +01:00
|
|
|
if (forms[i].needs_size) {
|
|
|
|
todo_wine ok(hr == E_INVALIDARG,
|
|
|
|
"GetDescriptor failed: %08x, expected E_INVALIDARG\n", hr);
|
|
|
|
desc.dwSize = sizeof(desc);
|
|
|
|
hr = IDirectMusicObject_GetDescriptor(dmo, &desc);
|
|
|
|
}
|
2018-03-02 01:16:08 +01:00
|
|
|
ok(hr == S_OK, "GetDescriptor failed: %08x, expected S_OK\n", hr);
|
|
|
|
ok(desc.dwValidData == DMUS_OBJ_CLASS, "Got valid data %#x, expected DMUS_OBJ_CLASS\n",
|
|
|
|
desc.dwValidData);
|
2018-03-06 01:07:25 +01:00
|
|
|
ok(IsEqualGUID(&desc.guidClass, forms[i].clsid), "Got class guid %s, expected CLSID_%s\n",
|
|
|
|
wine_dbgstr_guid(&desc.guidClass), forms[i].class);
|
2018-03-02 01:16:08 +01:00
|
|
|
|
|
|
|
/* Empty RIFF stream */
|
|
|
|
empty[1] = forms[i].form;
|
|
|
|
stream = gen_riff_stream(empty);
|
|
|
|
memset(&desc, 0, sizeof(desc));
|
|
|
|
hr = IDirectMusicObject_ParseDescriptor(dmo, stream, &desc);
|
2018-03-06 01:07:25 +01:00
|
|
|
if (forms[i].needs_size) {
|
2018-03-11 22:20:42 +01:00
|
|
|
ok(hr == E_INVALIDARG, "ParseDescriptor failed: %08x, expected E_INVALIDARG\n", hr);
|
2018-03-06 01:07:25 +01:00
|
|
|
desc.dwSize = sizeof(desc);
|
|
|
|
hr = IDirectMusicObject_ParseDescriptor(dmo, stream, &desc);
|
|
|
|
}
|
2018-03-11 22:20:42 +01:00
|
|
|
ok(hr == S_OK, "ParseDescriptor failed: %08x, expected S_OK\n", hr);
|
2018-03-02 01:16:08 +01:00
|
|
|
ok(desc.dwValidData == DMUS_OBJ_CLASS, "Got valid data %#x, expected DMUS_OBJ_CLASS\n",
|
|
|
|
desc.dwValidData);
|
2018-03-06 01:07:25 +01:00
|
|
|
ok(IsEqualGUID(&desc.guidClass, forms[i].clsid), "Got class guid %s, expected CLSID_%s\n",
|
|
|
|
wine_dbgstr_guid(&desc.guidClass), forms[i].class);
|
2018-03-02 01:16:08 +01:00
|
|
|
|
2018-03-11 22:20:43 +01:00
|
|
|
/* NULL pointers */
|
|
|
|
memset(&desc, 0, sizeof(desc));
|
|
|
|
desc.dwSize = sizeof(desc);
|
|
|
|
hr = IDirectMusicObject_ParseDescriptor(dmo, NULL, &desc);
|
|
|
|
ok(hr == E_POINTER, "ParseDescriptor failed: %08x, expected E_POINTER\n", hr);
|
|
|
|
hr = IDirectMusicObject_ParseDescriptor(dmo, stream, NULL);
|
|
|
|
if (forms[i].needs_size)
|
|
|
|
ok(hr == E_INVALIDARG, "ParseDescriptor failed: %08x, expected E_INVALIDARG\n", hr);
|
|
|
|
else
|
|
|
|
ok(hr == E_POINTER, "ParseDescriptor failed: %08x, expected E_POINTER\n", hr);
|
|
|
|
hr = IDirectMusicObject_ParseDescriptor(dmo, NULL, NULL);
|
|
|
|
ok(hr == E_POINTER, "ParseDescriptor failed: %08x, expected E_POINTER\n", hr);
|
2018-03-15 00:09:32 +01:00
|
|
|
IStream_Release(stream);
|
2018-03-11 22:20:43 +01:00
|
|
|
|
2018-03-02 01:16:08 +01:00
|
|
|
/* Wrong form */
|
|
|
|
empty[1] = DMUS_FOURCC_CONTAINER_FORM;
|
|
|
|
stream = gen_riff_stream(empty);
|
|
|
|
memset(&desc, 0, sizeof(desc));
|
2018-03-06 01:07:25 +01:00
|
|
|
desc.dwSize = sizeof(desc);
|
2018-03-02 01:16:08 +01:00
|
|
|
hr = IDirectMusicObject_ParseDescriptor(dmo, stream, &desc);
|
2018-03-15 00:09:33 +01:00
|
|
|
if (forms[i].needs_size)
|
|
|
|
ok(hr == DMUS_E_CHUNKNOTFOUND,
|
|
|
|
"ParseDescriptor failed: %08x, expected DMUS_E_CHUNKNOTFOUND\n", hr);
|
|
|
|
else
|
|
|
|
ok(hr == E_FAIL, "ParseDescriptor failed: %08x, expected E_FAIL\n", hr);
|
|
|
|
ok(!desc.dwValidData, "Got valid data %#x, expected 0\n", desc.dwValidData);
|
|
|
|
IStream_Release(stream);
|
|
|
|
|
|
|
|
/* Not a RIFF stream */
|
|
|
|
stream = gen_riff_stream(noriff);
|
|
|
|
memset(&desc, 0, sizeof(desc));
|
|
|
|
desc.dwSize = sizeof(desc);
|
|
|
|
hr = IDirectMusicObject_ParseDescriptor(dmo, stream, &desc);
|
2018-03-06 01:07:25 +01:00
|
|
|
if (forms[i].needs_size)
|
2018-03-11 22:20:42 +01:00
|
|
|
ok(hr == DMUS_E_CHUNKNOTFOUND,
|
2018-03-06 01:07:25 +01:00
|
|
|
"ParseDescriptor failed: %08x, expected DMUS_E_CHUNKNOTFOUND\n", hr);
|
|
|
|
else
|
|
|
|
ok(hr == E_FAIL, "ParseDescriptor failed: %08x, expected E_FAIL\n", hr);
|
2018-03-11 22:20:42 +01:00
|
|
|
ok(!desc.dwValidData, "Got valid data %#x, expected 0\n", desc.dwValidData);
|
2018-03-15 00:09:32 +01:00
|
|
|
IStream_Release(stream);
|
2018-03-02 01:16:08 +01:00
|
|
|
|
|
|
|
/* All desc chunks */
|
|
|
|
alldesc[1] = forms[i].form;
|
|
|
|
stream = gen_riff_stream(alldesc);
|
|
|
|
memset(&desc, 0, sizeof(desc));
|
2018-03-06 01:07:25 +01:00
|
|
|
desc.dwSize = sizeof(desc);
|
2018-03-02 01:16:08 +01:00
|
|
|
hr = IDirectMusicObject_ParseDescriptor(dmo, stream, &desc);
|
|
|
|
ok(hr == S_OK, "ParseDescriptor failed: %08x, expected S_OK\n", hr);
|
|
|
|
valid = DMUS_OBJ_OBJECT | DMUS_OBJ_CLASS | DMUS_OBJ_VERSION;
|
2018-03-06 01:07:25 +01:00
|
|
|
if (forms[i].form != mmioFOURCC('W','A','V','E'))
|
2018-03-02 01:16:08 +01:00
|
|
|
valid |= DMUS_OBJ_NAME | DMUS_OBJ_CATEGORY;
|
2018-03-11 22:20:40 +01:00
|
|
|
ok(desc.dwValidData == valid, "Got valid data %#x, expected %#x\n", desc.dwValidData, valid);
|
2018-03-06 01:07:25 +01:00
|
|
|
ok(IsEqualGUID(&desc.guidClass, forms[i].clsid), "Got class guid %s, expected CLSID_%s\n",
|
|
|
|
wine_dbgstr_guid(&desc.guidClass), forms[i].class);
|
2018-03-02 01:16:08 +01:00
|
|
|
ok(IsEqualGUID(&desc.guidObject, &GUID_NULL), "Got object guid %s, expected GUID_NULL\n",
|
|
|
|
wine_dbgstr_guid(&desc.guidClass));
|
2018-03-11 22:20:40 +01:00
|
|
|
ok(desc.vVersion.dwVersionMS == 5 && desc.vVersion.dwVersionLS == 8,
|
|
|
|
"Got version %u.%u, expected 5.8\n", desc.vVersion.dwVersionMS,
|
|
|
|
desc.vVersion.dwVersionLS);
|
|
|
|
if (forms[i].form != mmioFOURCC('W','A','V','E'))
|
2019-12-16 20:49:39 +01:00
|
|
|
ok(!lstrcmpW(desc.wszName, L"UNAM"), "Got name '%s', expected 'UNAM'\n",
|
2018-03-02 01:16:08 +01:00
|
|
|
wine_dbgstr_w(desc.wszName));
|
|
|
|
IStream_Release(stream);
|
|
|
|
|
|
|
|
/* Duplicated chunks */
|
|
|
|
dupes[1] = forms[i].form;
|
|
|
|
stream = gen_riff_stream(dupes);
|
|
|
|
memset(&desc, 0, sizeof(desc));
|
2018-03-06 01:07:25 +01:00
|
|
|
desc.dwSize = sizeof(desc);
|
2018-03-02 01:16:08 +01:00
|
|
|
hr = IDirectMusicObject_ParseDescriptor(dmo, stream, &desc);
|
|
|
|
ok(hr == S_OK, "ParseDescriptor failed: %08x, expected S_OK\n", hr);
|
2018-03-11 22:20:40 +01:00
|
|
|
ok(desc.dwValidData == valid, "Got valid data %#x, expected %#x\n", desc.dwValidData, valid);
|
2018-03-02 01:16:08 +01:00
|
|
|
IStream_Release(stream);
|
|
|
|
|
|
|
|
/* UNFO list with INAM */
|
|
|
|
inam[1] = forms[i].form;
|
|
|
|
inam[3] = DMUS_FOURCC_UNFO_LIST;
|
|
|
|
stream = gen_riff_stream(inam);
|
|
|
|
memset(&desc, 0, sizeof(desc));
|
2018-03-06 01:07:25 +01:00
|
|
|
desc.dwSize = sizeof(desc);
|
2018-03-02 01:16:08 +01:00
|
|
|
hr = IDirectMusicObject_ParseDescriptor(dmo, stream, &desc);
|
|
|
|
ok(hr == S_OK, "ParseDescriptor failed: %08x, expected S_OK\n", hr);
|
2018-03-11 22:20:42 +01:00
|
|
|
ok(desc.dwValidData == DMUS_OBJ_CLASS, "Got valid data %#x, expected DMUS_OBJ_CLASS\n",
|
|
|
|
desc.dwValidData);
|
2018-03-02 01:16:08 +01:00
|
|
|
IStream_Release(stream);
|
|
|
|
|
|
|
|
/* INFO list with INAM */
|
|
|
|
inam[3] = DMUS_FOURCC_INFO_LIST;
|
|
|
|
stream = gen_riff_stream(inam);
|
|
|
|
memset(&desc, 0, sizeof(desc));
|
2018-03-06 01:07:25 +01:00
|
|
|
desc.dwSize = sizeof(desc);
|
2018-03-02 01:16:08 +01:00
|
|
|
hr = IDirectMusicObject_ParseDescriptor(dmo, stream, &desc);
|
|
|
|
ok(hr == S_OK, "ParseDescriptor failed: %08x, expected S_OK\n", hr);
|
|
|
|
valid = DMUS_OBJ_CLASS;
|
|
|
|
if (forms[i].form == mmioFOURCC('W','A','V','E'))
|
|
|
|
valid |= DMUS_OBJ_NAME;
|
2018-03-11 22:20:40 +01:00
|
|
|
ok(desc.dwValidData == valid, "Got valid data %#x, expected %#x\n", desc.dwValidData, valid);
|
2018-03-02 01:16:08 +01:00
|
|
|
if (forms[i].form == mmioFOURCC('W','A','V','E'))
|
2019-12-16 20:49:39 +01:00
|
|
|
ok(!lstrcmpW(desc.wszName, L"I"), "Got name '%s', expected 'I'\n",
|
2018-03-11 22:20:40 +01:00
|
|
|
wine_dbgstr_w(desc.wszName));
|
2018-03-02 01:16:08 +01:00
|
|
|
IStream_Release(stream);
|
2018-03-06 01:07:25 +01:00
|
|
|
|
|
|
|
IDirectMusicObject_Release(dmo);
|
2018-03-02 01:16:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-10 10:42:57 +01:00
|
|
|
START_TEST(dmime)
|
|
|
|
{
|
|
|
|
CoInitialize(NULL);
|
|
|
|
|
|
|
|
if (missing_dmime())
|
|
|
|
{
|
|
|
|
skip("dmime not available\n");
|
|
|
|
CoUninitialize();
|
|
|
|
return;
|
|
|
|
}
|
2014-01-10 10:54:48 +01:00
|
|
|
test_COM_audiopath();
|
|
|
|
test_COM_audiopathconfig();
|
2014-01-10 10:48:05 +01:00
|
|
|
test_COM_graph();
|
2014-01-10 10:42:57 +01:00
|
|
|
test_COM_segment();
|
2014-01-10 10:44:34 +01:00
|
|
|
test_COM_segmentstate();
|
2014-01-10 10:47:03 +01:00
|
|
|
test_COM_track();
|
2014-05-30 23:08:01 +02:00
|
|
|
test_audiopathconfig();
|
|
|
|
test_graph();
|
|
|
|
test_segment();
|
2019-12-08 18:53:51 +01:00
|
|
|
test_gettrack();
|
2019-12-08 18:53:53 +01:00
|
|
|
test_segment_param();
|
2015-06-16 09:26:41 +02:00
|
|
|
test_track();
|
2018-03-02 01:16:08 +01:00
|
|
|
test_parsedescriptor();
|
2014-01-10 10:42:57 +01:00
|
|
|
|
|
|
|
CoUninitialize();
|
|
|
|
}
|