Commit 25dcca4b authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dmusic: Implement IDirectMusicPort_GetLatencyClock() for the midi port.

parent 8c48fba6
......@@ -907,6 +907,7 @@ HRESULT synth_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_param
struct midi_port {
IDirectMusicPort IDirectMusicPort_iface;
LONG ref;
IReferenceClock *clock;
};
static inline struct midi_port *impl_from_IDirectMusicPort(IDirectMusicPort *iface)
......@@ -949,8 +950,11 @@ static ULONG WINAPI midi_IDirectMusicPort_Release(IDirectMusicPort *iface)
TRACE("(%p) ref = %u\n", iface, ref);
if (!ref)
if (!ref) {
if (This->clock)
IReferenceClock_Release(This->clock);
heap_free(This);
}
return ref;
}
......@@ -999,9 +1003,17 @@ static HRESULT WINAPI midi_IDirectMusicPort_UnloadInstrument(IDirectMusicPort *i
static HRESULT WINAPI midi_IDirectMusicPort_GetLatencyClock(IDirectMusicPort *iface,
IReferenceClock **clock)
{
FIXME("(%p, %p) stub!\n", iface, clock);
struct midi_port *This = impl_from_IDirectMusicPort(iface);
return E_NOTIMPL;
TRACE("(%p, %p)\n", iface, clock);
if (!clock)
return E_POINTER;
*clock = This->clock;
IReferenceClock_AddRef(*clock);
return S_OK;
}
static HRESULT WINAPI midi_IDirectMusicPort_GetRunningStats(IDirectMusicPort *iface,
......@@ -1118,6 +1130,7 @@ HRESULT midi_out_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_pa
DMUS_PORTCAPS *port_caps, IDirectMusicPort **port)
{
struct midi_port *obj;
HRESULT hr;
TRACE("(%p, %p, %p)\n", port_params, port_caps, port);
......@@ -1127,6 +1140,12 @@ HRESULT midi_out_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_pa
obj->IDirectMusicPort_iface.lpVtbl = &midi_port_vtbl;
obj->ref = 1;
hr = DMUSIC_CreateReferenceClockImpl(&IID_IReferenceClock, (void **)&obj->clock, NULL);
if (hr != S_OK) {
HeapFree(GetProcessHeap(), 0, obj);
return hr;
}
*port = &obj->IDirectMusicPort_iface;
return S_OK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment