Author: akhaldi
Date: Sat Jun 3 18:05:52 2017
New Revision: 74777
URL:
http://svn.reactos.org/svn/reactos?rev=74777&view=rev
Log:
[DMUSIC] Sync with Wine Staging 2.9. CORE-13362
40a4a5c dmusic: Fail in CreatePort() if SetDirectSound() wasn't called.
62bf207 dmusic: Remove the port from the ports list on the port destruction.
3b4909f dmusic: Set the dsound pointer to NULL on an error path.
829ef41 dmusic: Fix compilation on systems that don't support nameless structs or
unions.
43b3f84 dmusic: Add dsound handling to the synth port Activate() method.
f968edb dmusic: Partially implement the synth IDirectMusicPort::SetDirectSound().
e8873b7 dmusic: Pass only the needed stuff to the DMPort create functions.
36a88d2 dmusic: Implement IDirectMusic8::SetDirectSound().
b75e8bc dmusic: Use more sensible and consistent field names for IDirectMusic8Impl.
950b8a9 dmusic: Avoid an intermediate copy in PackStructured().
7cd7f14 dmusic: Implement IDirectMusicBuffer::PackUnstructured().
4fbae8e dmusic: Use DMUS_EVENT_SIZE() to calculate the size of the message.
Modified:
trunk/reactos/dll/directx/wine/dmusic/CMakeLists.txt
trunk/reactos/dll/directx/wine/dmusic/buffer.c
trunk/reactos/dll/directx/wine/dmusic/dmusic.c
trunk/reactos/dll/directx/wine/dmusic/dmusic_private.h
trunk/reactos/dll/directx/wine/dmusic/port.c
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/directx/wine/dmusic/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dmusic/CM…
==============================================================================
--- trunk/reactos/dll/directx/wine/dmusic/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/dmusic/CMakeLists.txt [iso-8859-1] Sat Jun 3 18:05:52
2017
@@ -22,6 +22,6 @@
set_module_type(dmusic win32dll)
target_link_libraries(dmusic dxguid uuid wine)
-add_importlibs(dmusic ole32 advapi32 winmm msvcrt kernel32 ntdll)
+add_importlibs(dmusic ole32 advapi32 winmm dsound user32 msvcrt kernel32 ntdll)
add_pch(dmusic dmusic_private.h SOURCE)
add_cd_file(TARGET dmusic DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/dll/directx/wine/dmusic/buffer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dmusic/bu…
==============================================================================
--- trunk/reactos/dll/directx/wine/dmusic/buffer.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/dmusic/buffer.c [iso-8859-1] Sat Jun 3 18:05:52 2017
@@ -98,8 +98,8 @@
static HRESULT WINAPI IDirectMusicBufferImpl_PackStructured(LPDIRECTMUSICBUFFER iface,
REFERENCE_TIME ref_time, DWORD channel_group, DWORD channel_message)
{
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
- DWORD new_write_pos = This->write_pos + sizeof(DMUS_EVENTHEADER) + sizeof(DWORD);
- DMUS_EVENTHEADER header;
+ DWORD new_write_pos = This->write_pos + DMUS_EVENT_SIZE(sizeof(channel_message));
+ DMUS_EVENTHEADER *header;
TRACE("(%p)->(0x%s, %u, 0x%x)\n", iface, wine_dbgstr_longlong(ref_time),
channel_group, channel_message);
@@ -117,39 +117,40 @@
if (!This->write_pos)
This->start_time = ref_time;
- header.cbEvent = 3; /* Midi message takes 4 bytes space but only 3 are relevant */
- header.dwChannelGroup = channel_group;
- header.rtDelta = ref_time - This->start_time;
- header.dwFlags = DMUS_EVENT_STRUCTURED;
-
- memcpy(This->data + This->write_pos, &header, sizeof(header));
- *(DWORD*)(This->data + This->write_pos + sizeof(header)) = channel_message;
+ header = (DMUS_EVENTHEADER*)&This->data[This->write_pos];
+ header->cbEvent = 3; /* Midi message takes 4 bytes space but only 3 are relevant
*/
+ header->dwChannelGroup = channel_group;
+ header->rtDelta = ref_time - This->start_time;
+ header->dwFlags = DMUS_EVENT_STRUCTURED;
+
+ *(DWORD*)&header[1] = channel_message;
This->write_pos = new_write_pos;
return S_OK;
}
-static HRESULT WINAPI IDirectMusicBufferImpl_PackUnstructured(LPDIRECTMUSICBUFFER iface,
REFERENCE_TIME rt, DWORD dwChannelGroup, DWORD cb, LPBYTE lpb)
-{
- IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
- DWORD new_write_pos = This->write_pos + sizeof(DMUS_EVENTHEADER) + cb;
- DMUS_EVENTHEADER header;
-
- FIXME("(%p, 0x%s, %d, %d, %p): stub\n", This, wine_dbgstr_longlong(rt),
dwChannelGroup, cb, lpb);
+static HRESULT WINAPI IDirectMusicBufferImpl_PackUnstructured(IDirectMusicBuffer *iface,
+ REFERENCE_TIME ref_time, DWORD channel_group, DWORD len, BYTE *data)
+{
+ IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
+ DWORD new_write_pos = This->write_pos + DMUS_EVENT_SIZE(len);
+ DMUS_EVENTHEADER *header;
+
+ TRACE("(%p, 0x%s, %d, %d, %p)\n", This, wine_dbgstr_longlong(ref_time),
channel_group, len, data);
if (new_write_pos > This->size)
return DMUS_E_BUFFER_FULL;
if (!This->write_pos)
- This->start_time = rt;
-
- header.cbEvent = cb;
- header.dwChannelGroup = dwChannelGroup;
- header.rtDelta = rt - This->start_time;
- header.dwFlags = 0;
-
- memcpy(This->data + This->write_pos, &header, sizeof(header));
- memcpy(This->data + This->write_pos + sizeof(header), lpb, cb);
+ This->start_time = ref_time;
+
+ header = (DMUS_EVENTHEADER*)&This->data[This->write_pos];
+ header->cbEvent = len;
+ header->dwChannelGroup = channel_group;
+ header->rtDelta = ref_time - This->start_time;
+ header->dwFlags = 0;
+
+ memcpy(&header[1], data, len);
This->write_pos = new_write_pos;
return S_OK;
Modified: trunk/reactos/dll/directx/wine/dmusic/dmusic.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dmusic/dm…
==============================================================================
--- trunk/reactos/dll/directx/wine/dmusic/dmusic.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/dmusic/dmusic.c [iso-8859-1] Sat Jun 3 18:05:52 2017
@@ -21,6 +21,7 @@
#include "dmusic_private.h"
+#include <winuser.h>
#include <winreg.h>
static inline IDirectMusic8Impl *impl_from_IDirectMusic8(IDirectMusic8 *iface)
@@ -70,9 +71,11 @@
TRACE("(%p)->(): new ref = %u\n", This, ref);
if (!ref) {
- IReferenceClock_Release(&This->pMasterClock->IReferenceClock_iface);
+ IReferenceClock_Release(&This->master_clock->IReferenceClock_iface);
+ if (This->dsound)
+ IDirectSound_Release(This->dsound);
HeapFree(GetProcessHeap(), 0, This->system_ports);
- HeapFree(GetProcessHeap(), 0, This->ppPorts);
+ HeapFree(GetProcessHeap(), 0, This->ports);
HeapFree(GetProcessHeap(), 0, This);
DMUSIC_UnlockModule();
}
@@ -90,7 +93,7 @@
if (!port_caps)
return E_POINTER;
- if (index >= This->nb_system_ports)
+ if (index >= This->num_system_ports)
return S_FALSE;
*port_caps = This->system_ports[index].caps;
@@ -125,14 +128,14 @@
TRACE("(%p)->(%s, %p, %p, %p)\n", This, debugstr_dmguid(rclsid_port),
port_params, port, unkouter);
- if (!rclsid_port)
+ if (!rclsid_port || !port)
return E_POINTER;
if (!port_params)
return E_INVALIDARG;
- if (!port)
- return E_POINTER;
if (unkouter)
return CLASS_E_NOAGGREGATION;
+ if (!This->dsound)
+ return DMUS_E_DSOUND_NOT_SET;
if (TRACE_ON(dmusic))
dump_DMUS_PORTPARAMS(port_params);
@@ -149,17 +152,19 @@
for (i = 0; S_FALSE != IDirectMusic8Impl_EnumPort(iface, i, &port_caps); i++) {
if (IsEqualCLSID(request_port, &port_caps.guidPort)) {
- hr = This->system_ports[i].create(&IID_IDirectMusicPort,
(LPVOID*)&new_port, (LPUNKNOWN)This, port_params, &port_caps,
This->system_ports[i].device);
+ hr = This->system_ports[i].create(This, port_params, &port_caps,
&new_port);
if (FAILED(hr)) {
*port = NULL;
return hr;
}
- This->nrofports++;
- if (!This->ppPorts)
- This->ppPorts = HeapAlloc(GetProcessHeap(), 0,
sizeof(LPDIRECTMUSICPORT) * This->nrofports);
+ This->num_ports++;
+ if (!This->ports)
+ This->ports = HeapAlloc(GetProcessHeap(), 0,
+ sizeof(*This->ports) * This->num_ports);
else
- This->ppPorts = HeapReAlloc(GetProcessHeap(), 0, This->ppPorts,
sizeof(LPDIRECTMUSICPORT) * This->nrofports);
- This->ppPorts[This->nrofports - 1] = new_port;
+ This->ports = HeapReAlloc(GetProcessHeap(), 0, This->ports,
+ sizeof(*This->ports) * This->num_ports);
+ This->ports[This->num_ports - 1] = new_port;
*port = new_port;
return S_OK;
}
@@ -168,6 +173,39 @@
return E_NOINTERFACE;
}
+void dmusic_remove_port(IDirectMusic8Impl *dmusic, IDirectMusicPort *port)
+{
+ BOOL found = FALSE;
+ int i;
+
+ TRACE("Removing port %p.\n", port);
+
+ for (i = 0; i < dmusic->num_ports; i++)
+ {
+ if (dmusic->ports[i] == port) {
+ found = TRUE;
+ break;
+ }
+ }
+
+ if (!found)
+ {
+ ERR("Port %p not found in ports array.\n", port);
+ return;
+ }
+
+ if (!--dmusic->num_ports) {
+ HeapFree(GetProcessHeap(), 0, dmusic->ports);
+ dmusic->ports = NULL;
+ return;
+ }
+
+ memmove(&dmusic->ports[i], &dmusic->ports[i + 1],
+ (dmusic->num_ports - i) * sizeof(*dmusic->ports));
+ dmusic->ports = HeapReAlloc(GetProcessHeap(), 0, dmusic->ports,
+ sizeof(*dmusic->ports) * dmusic->num_ports);
+}
+
static HRESULT WINAPI IDirectMusic8Impl_EnumMasterClock(LPDIRECTMUSIC8 iface, DWORD
index, LPDMUS_CLOCKINFO clock_info)
{
TRACE("(%p)->(%d, %p)\n", iface, index, clock_info);
@@ -207,9 +245,9 @@
TRACE("(%p)->(%p, %p)\n", This, guid_clock, reference_clock);
if (guid_clock)
- *guid_clock = This->pMasterClock->pClockInfo.guidClock;
+ *guid_clock = This->master_clock->pClockInfo.guidClock;
if (reference_clock) {
- *reference_clock = &This->pMasterClock->IReferenceClock_iface;
+ *reference_clock = &This->master_clock->IReferenceClock_iface;
IReferenceClock_AddRef(*reference_clock);
}
@@ -233,9 +271,9 @@
TRACE("(%p)->(%u)\n", This, enable);
- for (i = 0; i < This->nrofports; i++)
- {
- hr = IDirectMusicPort_Activate(This->ppPorts[i], enable);
+ for (i = 0; i < This->num_ports; i++)
+ {
+ hr = IDirectMusicPort_Activate(This->ports[i], enable);
if (FAILED(hr))
return hr;
}
@@ -269,11 +307,40 @@
return S_OK;
}
-static HRESULT WINAPI IDirectMusic8Impl_SetDirectSound(LPDIRECTMUSIC8 iface,
LPDIRECTSOUND dsound, HWND wnd)
-{
- IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
-
- FIXME("(%p)->(%p, %p): stub\n", This, dsound, wnd);
+static HRESULT WINAPI IDirectMusic8Impl_SetDirectSound(IDirectMusic8 *iface, IDirectSound
*dsound,
+ HWND hwnd)
+{
+ IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
+ HRESULT hr;
+ int i;
+
+ TRACE("(%p)->(%p, %p)\n", This, dsound, hwnd);
+
+ for (i = 0; i < This->num_ports; i++)
+ {
+ hr = IDirectMusicPort_SetDirectSound(This->ports[i], NULL, NULL);
+ if (FAILED(hr))
+ return hr;
+ }
+
+ if (This->dsound)
+ IDirectSound_Release(This->dsound);
+
+ if (!dsound) {
+ hr = DirectSoundCreate8(NULL, (IDirectSound8 **)&This->dsound, NULL);
+ if (FAILED(hr))
+ return hr;
+ hr = IDirectSound_SetCooperativeLevel(This->dsound, hwnd ? hwnd :
GetForegroundWindow(),
+ DSSCL_PRIORITY);
+ if (FAILED(hr)) {
+ IDirectSound_Release(This->dsound);
+ This->dsound = NULL;
+ }
+ return hr;
+ }
+
+ IDirectSound_AddRef(dsound);
+ This->dsound = dsound;
return S_OK;
}
@@ -348,7 +415,7 @@
/* Fill midi mapper port info */
port->device = MIDI_MAPPER;
- port->create = DMUSIC_CreateMidiOutPortImpl;
+ port->create = midi_out_port_create;
midiOutGetDevCapsW(MIDI_MAPPER, &caps_out, sizeof(caps_out));
strcpyW(port->caps.wszDescription, caps_out.szPname);
strcatW(port->caps.wszDescription, emulated);
@@ -360,7 +427,7 @@
for (i = 0; i < nb_midi_out; i++)
{
port->device = i;
- port->create = DMUSIC_CreateMidiOutPortImpl;
+ port->create = midi_out_port_create;
midiOutGetDevCapsW(i, &caps_out, sizeof(caps_out));
strcpyW(port->caps.wszDescription, caps_out.szPname);
strcatW(port->caps.wszDescription, emulated);
@@ -373,7 +440,7 @@
for (i = 0; i < nb_midi_in; i++)
{
port->device = i;
- port->create = DMUSIC_CreateMidiInPortImpl;
+ port->create = midi_in_port_create;
midiInGetDevCapsW(i, &caps_in, sizeof(caps_in));
strcpyW(port->caps.wszDescription, caps_in.szPname);
strcatW(port->caps.wszDescription, emulated);
@@ -383,7 +450,7 @@
}
/* Fill synth port info */
- port->create = DMUSIC_CreateSynthPortImpl;
+ port->create = synth_port_create;
hr = CoCreateInstance(&CLSID_DirectMusicSynth, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectMusicSynth8, (void**)&synth);
if (SUCCEEDED(hr))
{
@@ -394,7 +461,7 @@
if (FAILED(hr))
nb_ports--;
- object->nb_system_ports = nb_ports;
+ object->num_system_ports = nb_ports;
}
/* For ClassFactory */
@@ -415,10 +482,7 @@
dmusic->IDirectMusic8_iface.lpVtbl = &DirectMusic8_Vtbl;
dmusic->ref = 1;
- dmusic->pMasterClock = NULL;
- dmusic->ppPorts = NULL;
- dmusic->nrofports = 0;
- ret = DMUSIC_CreateReferenceClockImpl(&IID_IReferenceClock,
(LPVOID*)&dmusic->pMasterClock, NULL);
+ ret = DMUSIC_CreateReferenceClockImpl(&IID_IReferenceClock, (void
**)&dmusic->master_clock, NULL);
if (FAILED(ret)) {
HeapFree(GetProcessHeap(), 0, dmusic);
return ret;
Modified: trunk/reactos/dll/directx/wine/dmusic/dmusic_private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dmusic/dm…
==============================================================================
--- trunk/reactos/dll/directx/wine/dmusic/dmusic_private.h [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/dmusic/dmusic_private.h [iso-8859-1] Sat Jun 3
18:05:52 2017
@@ -31,6 +31,8 @@
#define COM_NO_WINDOWS_H
#define COBJMACROS
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
#include <windef.h>
#include <winbase.h>
@@ -75,7 +77,8 @@
typedef struct port_info {
DMUS_PORTCAPS caps;
- HRESULT (*create)(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS
port_params, LPDMUS_PORTCAPS port_caps, DWORD device);
+ HRESULT (*create)(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params,
+ DMUS_PORTCAPS *port_caps, IDirectMusicPort **port);
ULONG device;
} port_info;
@@ -110,16 +113,14 @@
* IDirectMusic8Impl implementation structure
*/
struct IDirectMusic8Impl {
- /* IUnknown fields */
IDirectMusic8 IDirectMusic8_iface;
LONG ref;
-
- /* IDirectMusicImpl fields */
- IReferenceClockImpl* pMasterClock;
- IDirectMusicPort** ppPorts;
- int nrofports;
- port_info* system_ports;
- int nb_system_ports;
+ IDirectSound *dsound;
+ IReferenceClockImpl *master_clock;
+ IDirectMusicPort **ports;
+ int num_ports;
+ port_info *system_ports;
+ int num_system_ports;
};
/*****************************************************************************
@@ -163,9 +164,12 @@
};
/** Internal factory */
-extern HRESULT DMUSIC_CreateSynthPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN
unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device)
DECLSPEC_HIDDEN;
-extern HRESULT DMUSIC_CreateMidiOutPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN
unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device)
DECLSPEC_HIDDEN;
-extern HRESULT DMUSIC_CreateMidiInPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN
unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device)
DECLSPEC_HIDDEN;
+extern HRESULT synth_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS
*port_params,
+ DMUS_PORTCAPS *port_caps, IDirectMusicPort **port) DECLSPEC_HIDDEN;
+extern HRESULT midi_out_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS
*port_params,
+ DMUS_PORTCAPS *port_caps, IDirectMusicPort **port) DECLSPEC_HIDDEN;
+extern HRESULT midi_in_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS
*port_params,
+ DMUS_PORTCAPS *port_caps, IDirectMusicPort **port) DECLSPEC_HIDDEN;
/*****************************************************************************
* IReferenceClockImpl implementation structure
@@ -229,6 +233,8 @@
/*****************************************************************************
* Misc.
*/
+void dmusic_remove_port(IDirectMusic8Impl *dmusic, IDirectMusicPort *port)
DECLSPEC_HIDDEN;
+
/* for simpler reading */
typedef struct _DMUS_PRIVATE_CHUNK {
FOURCC fccID; /* FOURCC ID of the chunk */
Modified: trunk/reactos/dll/directx/wine/dmusic/port.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dmusic/po…
==============================================================================
--- trunk/reactos/dll/directx/wine/dmusic/port.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/dmusic/port.c [iso-8859-1] Sat Jun 3 18:05:52 2017
@@ -29,11 +29,13 @@
IDirectMusicThru IDirectMusicThru_iface;
IKsControl IKsControl_iface;
LONG ref;
- IDirectSound *pDirectSound;
+ IDirectMusic8Impl *parent;
+ IDirectSound *dsound;
+ IDirectSoundBuffer *dsbuffer;
IReferenceClock *pLatencyClock;
IDirectMusicSynth *synth;
IDirectMusicSynthSink *synth_sink;
- BOOL fActive;
+ BOOL active;
DMUS_PORTCAPS caps;
DMUS_PORTPARAMS params;
int nrofgroups;
@@ -191,11 +193,16 @@
if (!ref)
{
+ dmusic_remove_port(This->parent, iface);
IDirectMusicSynth_Activate(This->synth, FALSE);
IDirectMusicSynth_Close(This->synth);
IDirectMusicSynth_Release(This->synth);
IDirectMusicSynthSink_Release(This->synth_sink);
IReferenceClock_Release(This->pLatencyClock);
+ if (This->dsbuffer)
+ IDirectSoundBuffer_Release(This->dsbuffer);
+ if (This->dsound)
+ IDirectSound_Release(This->dsound);
HeapFree(GetProcessHeap(), 0, This);
}
@@ -429,13 +436,31 @@
return S_OK;
}
-static HRESULT WINAPI SynthPortImpl_IDirectMusicPort_Activate(LPDIRECTMUSICPORT iface,
BOOL active)
-{
- SynthPortImpl *This = impl_from_SynthPortImpl_IDirectMusicPort(iface);
-
- TRACE("(%p/%p)->(%d)\n", iface, This, active);
-
- This->fActive = active;
+static HRESULT WINAPI synth_dmport_Activate(IDirectMusicPort *iface, BOOL active)
+{
+ SynthPortImpl *This = impl_from_SynthPortImpl_IDirectMusicPort(iface);
+
+ FIXME("(%p/%p)->(%d): semi-stub\n", iface, This, active);
+
+ if (This->active == active)
+ return S_FALSE;
+
+ if (active) {
+ /* Acquire the dsound */
+ if (!This->dsound) {
+ IDirectSound_AddRef(This->parent->dsound);
+ This->dsound = This->parent->dsound;
+ }
+ IDirectSound_AddRef(This->dsound);
+ } else {
+ /* Release the dsound */
+ IDirectSound_Release(This->dsound);
+ IDirectSound_Release(This->parent->dsound);
+ if (This->dsound == This->parent->dsound)
+ This->dsound = NULL;
+ }
+
+ This->active = active;
return S_OK;
}
@@ -466,11 +491,33 @@
return S_OK;
}
-static HRESULT WINAPI SynthPortImpl_IDirectMusicPort_SetDirectSound(LPDIRECTMUSICPORT
iface, LPDIRECTSOUND direct_sound, LPDIRECTSOUNDBUFFER direct_sound_buffer)
-{
- SynthPortImpl *This = impl_from_SynthPortImpl_IDirectMusicPort(iface);
-
- FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, direct_sound,
direct_sound_buffer);
+static HRESULT WINAPI synth_dmport_SetDirectSound(IDirectMusicPort *iface, IDirectSound
*dsound,
+ IDirectSoundBuffer *dsbuffer)
+{
+ SynthPortImpl *This = impl_from_SynthPortImpl_IDirectMusicPort(iface);
+
+ FIXME("(%p/%p)->(%p, %p): semi-stub\n", iface, This, dsound, dsbuffer);
+
+ if (This->active)
+ return DMUS_E_DSOUND_ALREADY_SET;
+
+ if (This->dsound) {
+ if (This->dsound != This->parent->dsound)
+ ERR("Not the same dsound in the port (%p) and parent dmusic (%p), expect
trouble!\n",
+ This->dsound, This->parent->dsound);
+ if (!IDirectSound_Release(This->parent->dsound))
+ This->parent->dsound = NULL;
+ }
+ if (This->dsbuffer)
+ IDirectSound_Release(This->dsbuffer);
+
+ This->dsound = dsound;
+ This->dsbuffer = dsbuffer;
+
+ if (This->dsound)
+ IDirectSound_AddRef(This->dsound);
+ if (This->dsbuffer)
+ IDirectSound_AddRef(This->dsbuffer);
return S_OK;
}
@@ -538,10 +585,10 @@
SynthPortImpl_IDirectMusicPort_DeviceIoControl,
SynthPortImpl_IDirectMusicPort_SetNumChannelGroups,
SynthPortImpl_IDirectMusicPort_GetNumChannelGroups,
- SynthPortImpl_IDirectMusicPort_Activate,
+ synth_dmport_Activate,
SynthPortImpl_IDirectMusicPort_SetChannelPriority,
SynthPortImpl_IDirectMusicPort_GetChannelPriority,
- SynthPortImpl_IDirectMusicPort_SetDirectSound,
+ synth_dmport_SetDirectSound,
SynthPortImpl_IDirectMusicPort_GetFormat
};
@@ -719,18 +766,18 @@
ULONG prop_len, void *data, ULONG data_len, ULONG *ret_len)
{
TRACE("(%p)->(%p, %u, %p, %u, %p)\n", iface, prop, prop_len, data,
data_len, ret_len);
- TRACE("prop = %s - %u - %u\n", debugstr_guid(&prop->Set),
prop->Id, prop->Flags);
-
- if (prop->Flags != KSPROPERTY_TYPE_GET)
+ TRACE("prop = %s - %u - %u\n", debugstr_guid(&prop->u.s.Set),
prop->u.s.Id, prop->u.s.Flags);
+
+ if (prop->u.s.Flags != KSPROPERTY_TYPE_GET)
{
- FIXME("prop flags %u not yet supported\n", prop->Flags);
+ FIXME("prop flags %u not yet supported\n", prop->u.s.Flags);
return S_FALSE;
}
if (data_len < sizeof(DWORD))
return E_NOT_SUFFICIENT_BUFFER;
- FIXME("Unknown property %s\n", debugstr_guid(&prop->Set));
+ FIXME("Unknown property %s\n", debugstr_guid(&prop->u.s.Set));
*(DWORD*)data = FALSE;
*ret_len = sizeof(DWORD);
@@ -762,16 +809,16 @@
IKsControlImpl_KsEvent
};
-HRESULT DMUSIC_CreateSynthPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter,
LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device)
+HRESULT synth_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params,
+ DMUS_PORTCAPS *port_caps, IDirectMusicPort **port)
{
SynthPortImpl *obj;
HRESULT hr = E_FAIL;
int i;
- TRACE("(%s, %p, %p, %p, %p, %d)\n", debugstr_guid(guid), object, unkouter,
port_params,
- port_caps, device);
-
- *object = NULL;
+ TRACE("(%p, %p, %p)\n", port_params, port_caps, port);
+
+ *port = NULL;
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SynthPortImpl));
if (!obj)
@@ -781,8 +828,9 @@
obj->IDirectMusicPortDownload_iface.lpVtbl =
&SynthPortImpl_DirectMusicPortDownload_Vtbl;
obj->IDirectMusicThru_iface.lpVtbl = &SynthPortImpl_DirectMusicThru_Vtbl;
obj->IKsControl_iface.lpVtbl = &ikscontrol_vtbl;
- obj->ref = 0; /* Will be inited by QueryInterface */
- obj->fActive = FALSE;
+ obj->ref = 1;
+ obj->parent = parent;
+ obj->active = FALSE;
obj->params = *port_params;
obj->caps = *port_caps;
@@ -838,8 +886,10 @@
}
}
- if (SUCCEEDED(hr))
- return IDirectMusicPort_QueryInterface((LPDIRECTMUSICPORT)obj, guid, object);
+ if (SUCCEEDED(hr)) {
+ *port = &obj->IDirectMusicPort_iface;
+ return S_OK;
+ }
if (obj->synth)
IDirectMusicSynth_Release(obj->synth);
@@ -852,18 +902,18 @@
return hr;
}
-HRESULT DMUSIC_CreateMidiOutPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter,
LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device)
-{
- TRACE("(%s, %p, %p, %p, %p, %d): stub\n", debugstr_guid(guid), object,
unkouter, port_params,
- port_caps, device);
+HRESULT midi_out_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params,
+ DMUS_PORTCAPS *port_caps, IDirectMusicPort **port)
+{
+ FIXME("(%p, %p, %p): stub\n", port_params, port_caps, port);
return E_NOTIMPL;
}
-HRESULT DMUSIC_CreateMidiInPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter,
LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device)
-{
- TRACE("(%s, %p, %p, %p, %p, %d): stub\n", debugstr_guid(guid), object,
unkouter, port_params,
- port_caps, device);
+HRESULT midi_in_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params,
+ DMUS_PORTCAPS *port_caps, IDirectMusicPort **port)
+{
+ FIXME("(%p, %p, %p): stub\n", port_params, port_caps, port);
return E_NOTIMPL;
}
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Jun 3 18:05:52 2017
@@ -32,7 +32,7 @@
reactos/dll/directx/wine/devenum # Synced to WineStaging-2.9
reactos/dll/directx/wine/dinput # Synced to WineStaging-2.9
reactos/dll/directx/wine/dinput8 # Synced to WineStaging-1.9.23
-reactos/dll/directx/wine/dmusic # Synced to WineStaging-1.9.23
+reactos/dll/directx/wine/dmusic # Synced to WineStaging-2.9
reactos/dll/directx/wine/dplay # Synced to WineStaging-1.9.23
reactos/dll/directx/wine/dplayx # Synced to WineStaging-2.2
reactos/dll/directx/wine/dsound # Synced to Wine-1.3.29