dmusic: Add a stub midi out port.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-08-20 00:01:34 +02:00 committed by Alexandre Julliard
parent 9ccf51e3c1
commit 8c48fba6a2
1 changed files with 223 additions and 2 deletions

View File

@ -21,6 +21,7 @@
#include <assert.h> #include <assert.h>
#include "dmusic_private.h" #include "dmusic_private.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic); WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
@ -903,12 +904,232 @@ HRESULT synth_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_param
return hr; return hr;
} }
struct midi_port {
IDirectMusicPort IDirectMusicPort_iface;
LONG ref;
};
static inline struct midi_port *impl_from_IDirectMusicPort(IDirectMusicPort *iface)
{
return CONTAINING_RECORD(iface, struct midi_port, IDirectMusicPort_iface);
}
static HRESULT WINAPI midi_IDirectMusicPort_QueryInterface(IDirectMusicPort *iface, REFIID riid,
void **ret_iface)
{
TRACE("(%p, %s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicPort))
*ret_iface = iface;
else {
WARN("no interface for %s\n", debugstr_dmguid(riid));
*ret_iface = NULL;
return E_NOINTERFACE;
}
IDirectMusicPort_AddRef(iface);
return S_OK;
}
static ULONG WINAPI midi_IDirectMusicPort_AddRef(IDirectMusicPort *iface)
{
struct midi_port *This = impl_from_IDirectMusicPort(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref = %u\n", iface, ref);
return ref;
}
static ULONG WINAPI midi_IDirectMusicPort_Release(IDirectMusicPort *iface)
{
struct midi_port *This = impl_from_IDirectMusicPort(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref = %u\n", iface, ref);
if (!ref)
heap_free(This);
return ref;
}
static HRESULT WINAPI midi_IDirectMusicPort_PlayBuffer(IDirectMusicPort *iface,
IDirectMusicBuffer *buffer)
{
FIXME("(%p, %p) stub!\n", iface, buffer);
return E_NOTIMPL;
}
static HRESULT WINAPI midi_IDirectMusicPort_SetReadNotificationHandle(IDirectMusicPort *iface,
HANDLE event)
{
FIXME("(%p, %p) stub!\n", iface, event);
return E_NOTIMPL;
}
static HRESULT WINAPI midi_IDirectMusicPort_Read(IDirectMusicPort *iface,
IDirectMusicBuffer *buffer)
{
FIXME("(%p, %p) stub!\n", iface, buffer);
return E_NOTIMPL;
}
static HRESULT WINAPI midi_IDirectMusicPort_DownloadInstrument(IDirectMusicPort *iface,
IDirectMusicInstrument *instrument, IDirectMusicDownloadedInstrument **downloaded,
DMUS_NOTERANGE *ranges, DWORD num_ranges)
{
FIXME("(%p, %p, %p, %p, %u) stub!\n", iface, instrument, downloaded, ranges, num_ranges);
return E_NOTIMPL;
}
static HRESULT WINAPI midi_IDirectMusicPort_UnloadInstrument(IDirectMusicPort *iface,
IDirectMusicDownloadedInstrument *downloaded)
{
FIXME("(%p, %p) stub!\n", iface, downloaded);
return E_NOTIMPL;
}
static HRESULT WINAPI midi_IDirectMusicPort_GetLatencyClock(IDirectMusicPort *iface,
IReferenceClock **clock)
{
FIXME("(%p, %p) stub!\n", iface, clock);
return E_NOTIMPL;
}
static HRESULT WINAPI midi_IDirectMusicPort_GetRunningStats(IDirectMusicPort *iface,
DMUS_SYNTHSTATS *stats)
{
FIXME("(%p, %p) stub!\n", iface, stats);
return E_NOTIMPL;
}
static HRESULT WINAPI midi_IDirectMusicPort_Compact(IDirectMusicPort *iface)
{
FIXME("(%p) stub!\n", iface);
return E_NOTIMPL;
}
static HRESULT WINAPI midi_IDirectMusicPort_GetCaps(IDirectMusicPort *iface, DMUS_PORTCAPS *caps)
{
FIXME("(%p, %p) stub!\n", iface, caps);
return E_NOTIMPL;
}
static HRESULT WINAPI midi_IDirectMusicPort_DeviceIoControl(IDirectMusicPort *iface,
DWORD io_control_code, void *in, DWORD size_in, void *out, DWORD size_out, DWORD *ret_len,
OVERLAPPED *overlapped)
{
FIXME("(%p, %u, %p, %u, %p, %u, %p, %p) stub!\n", iface, io_control_code, in, size_in, out
, size_out, ret_len, overlapped);
return E_NOTIMPL;
}
static HRESULT WINAPI midi_IDirectMusicPort_SetNumChannelGroups(IDirectMusicPort *iface,
DWORD cgroups)
{
FIXME("(%p, %u) stub!\n", iface, cgroups);
return E_NOTIMPL;
}
static HRESULT WINAPI midi_IDirectMusicPort_GetNumChannelGroups(IDirectMusicPort *iface,
DWORD *cgroups)
{
FIXME("(%p, %p) stub!\n", iface, cgroups);
return E_NOTIMPL;
}
static HRESULT WINAPI midi_IDirectMusicPort_Activate(IDirectMusicPort *iface, BOOL active)
{
FIXME("(%p, %u) stub!\n", iface, active);
return S_OK;
}
static HRESULT WINAPI midi_IDirectMusicPort_SetChannelPriority(IDirectMusicPort *iface,
DWORD channel_group, DWORD channel, DWORD priority)
{
FIXME("(%p, %u, %u, %u) stub!\n", iface, channel_group, channel, priority);
return E_NOTIMPL;
}
static HRESULT WINAPI midi_IDirectMusicPort_GetChannelPriority(IDirectMusicPort *iface,
DWORD channel_group, DWORD channel, DWORD *priority)
{
FIXME("(%p, %u, %u, %p) stub!\n", iface, channel_group, channel, priority);
return E_NOTIMPL;
}
static HRESULT WINAPI midi_IDirectMusicPort_SetDirectSound(IDirectMusicPort *iface,
IDirectSound *dsound, IDirectSoundBuffer *dsbuffer)
{
FIXME("(%p, %p, %p) stub!\n", iface, dsound, dsbuffer);
return E_NOTIMPL;
}
static HRESULT WINAPI midi_IDirectMusicPort_GetFormat(IDirectMusicPort *iface, WAVEFORMATEX *format,
DWORD *format_size, DWORD *buffer_size)
{
FIXME("(%p, %p, %p, %p) stub!\n", iface, format, format_size, buffer_size);
return E_NOTIMPL;
}
static const IDirectMusicPortVtbl midi_port_vtbl = {
midi_IDirectMusicPort_QueryInterface,
midi_IDirectMusicPort_AddRef,
midi_IDirectMusicPort_Release,
midi_IDirectMusicPort_PlayBuffer,
midi_IDirectMusicPort_SetReadNotificationHandle,
midi_IDirectMusicPort_Read,
midi_IDirectMusicPort_DownloadInstrument,
midi_IDirectMusicPort_UnloadInstrument,
midi_IDirectMusicPort_GetLatencyClock,
midi_IDirectMusicPort_GetRunningStats,
midi_IDirectMusicPort_Compact,
midi_IDirectMusicPort_GetCaps,
midi_IDirectMusicPort_DeviceIoControl,
midi_IDirectMusicPort_SetNumChannelGroups,
midi_IDirectMusicPort_GetNumChannelGroups,
midi_IDirectMusicPort_Activate,
midi_IDirectMusicPort_SetChannelPriority,
midi_IDirectMusicPort_GetChannelPriority,
midi_IDirectMusicPort_SetDirectSound,
midi_IDirectMusicPort_GetFormat,
};
HRESULT midi_out_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params, HRESULT midi_out_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params,
DMUS_PORTCAPS *port_caps, IDirectMusicPort **port) DMUS_PORTCAPS *port_caps, IDirectMusicPort **port)
{ {
FIXME("(%p, %p, %p): stub\n", port_params, port_caps, port); struct midi_port *obj;
return E_NOTIMPL; TRACE("(%p, %p, %p)\n", port_params, port_caps, port);
if (!(obj = heap_alloc_zero(sizeof(*obj))))
return E_OUTOFMEMORY;
obj->IDirectMusicPort_iface.lpVtbl = &midi_port_vtbl;
obj->ref = 1;
*port = &obj->IDirectMusicPort_iface;
return S_OK;
} }
HRESULT midi_in_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params, HRESULT midi_in_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params,