dmusic: Pass only the needed stuff to the DMPort create functions.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
36a88d2841
commit
e8873b75af
|
@ -153,7 +153,7 @@ static HRESULT WINAPI IDirectMusic8Impl_CreatePort(LPDIRECTMUSIC8 iface, REFCLSI
|
|||
|
||||
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;
|
||||
|
@ -379,7 +379,7 @@ static void create_system_ports_list(IDirectMusic8Impl* object)
|
|||
|
||||
/* 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);
|
||||
|
@ -391,7 +391,7 @@ static void create_system_ports_list(IDirectMusic8Impl* object)
|
|||
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);
|
||||
|
@ -404,7 +404,7 @@ static void create_system_ports_list(IDirectMusic8Impl* object)
|
|||
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);
|
||||
|
@ -414,7 +414,7 @@ static void create_system_ports_list(IDirectMusic8Impl* object)
|
|||
}
|
||||
|
||||
/* 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))
|
||||
{
|
||||
|
|
|
@ -71,7 +71,8 @@ typedef struct DMUSIC_PRIVATE_CHANNEL_GROUP_ {
|
|||
|
||||
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;
|
||||
|
||||
|
@ -157,9 +158,12 @@ struct IDirectMusicDownloadImpl {
|
|||
};
|
||||
|
||||
/** 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
|
||||
|
|
|
@ -30,6 +30,7 @@ typedef struct SynthPortImpl {
|
|||
IDirectMusicThru IDirectMusicThru_iface;
|
||||
IKsControl IKsControl_iface;
|
||||
LONG ref;
|
||||
IDirectMusic8Impl *parent;
|
||||
IDirectSound *pDirectSound;
|
||||
IReferenceClock *pLatencyClock;
|
||||
IDirectMusicSynth *synth;
|
||||
|
@ -763,16 +764,16 @@ static const IKsControlVtbl ikscontrol_vtbl = {
|
|||
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);
|
||||
TRACE("(%p, %p, %p)\n", port_params, port_caps, port);
|
||||
|
||||
*object = NULL;
|
||||
*port = NULL;
|
||||
|
||||
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SynthPortImpl));
|
||||
if (!obj)
|
||||
|
@ -782,7 +783,8 @@ HRESULT DMUSIC_CreateSynthPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkou
|
|||
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->ref = 1;
|
||||
obj->parent = parent;
|
||||
obj->fActive = FALSE;
|
||||
obj->params = *port_params;
|
||||
obj->caps = *port_caps;
|
||||
|
@ -839,8 +841,10 @@ HRESULT DMUSIC_CreateSynthPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkou
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -853,18 +857,18 @@ HRESULT DMUSIC_CreateSynthPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkou
|
|||
return hr;
|
||||
}
|
||||
|
||||
HRESULT DMUSIC_CreateMidiOutPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device)
|
||||
HRESULT midi_out_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params,
|
||||
DMUS_PORTCAPS *port_caps, IDirectMusicPort **port)
|
||||
{
|
||||
TRACE("(%s, %p, %p, %p, %p, %d): stub\n", debugstr_guid(guid), object, unkouter, port_params,
|
||||
port_caps, device);
|
||||
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)
|
||||
HRESULT midi_in_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params,
|
||||
DMUS_PORTCAPS *port_caps, IDirectMusicPort **port)
|
||||
{
|
||||
TRACE("(%s, %p, %p, %p, %p, %d): stub\n", debugstr_guid(guid), object, unkouter, port_params,
|
||||
port_caps, device);
|
||||
FIXME("(%p, %p, %p): stub\n", port_params, port_caps, port);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue