mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-03 01:51:48 +00:00
dmime: Output DMUS_MIDI_PMSG into a music buffer on the port.
This commit is contained in:
parent
e3b23cb66e
commit
a4b006e723
|
@ -1637,6 +1637,39 @@ static HRESULT WINAPI performance_tool_ProcessPMsg(IDirectMusicTool *iface,
|
|||
|
||||
switch (msg->dwType)
|
||||
{
|
||||
case DMUS_PMSGT_MIDI:
|
||||
{
|
||||
static const UINT event_size = sizeof(DMUS_EVENTHEADER) + sizeof(DWORD);
|
||||
DMUS_BUFFERDESC desc = {.dwSize = sizeof(desc), .cbBuffer = 2 * event_size};
|
||||
DMUS_MIDI_PMSG *midi = (DMUS_MIDI_PMSG *)msg;
|
||||
IDirectMusicBuffer *buffer;
|
||||
IDirectMusicPort *port;
|
||||
DWORD group, channel;
|
||||
UINT value = 0;
|
||||
|
||||
if (FAILED(hr = IDirectMusicPerformance_PChannelInfo(performance, msg->dwPChannel,
|
||||
&port, &group, &channel)))
|
||||
{
|
||||
WARN("Failed to get message port, hr %#lx\n", hr);
|
||||
return DMUS_S_FREE;
|
||||
}
|
||||
|
||||
value |= channel;
|
||||
value |= (UINT)midi->bStatus;
|
||||
value |= (UINT)midi->bByte1 << 8;
|
||||
value |= (UINT)midi->bByte2 << 16;
|
||||
|
||||
if (SUCCEEDED(hr = IDirectMusic_CreateMusicBuffer(This->dmusic, &desc, &buffer, NULL)))
|
||||
{
|
||||
hr = IDirectMusicBuffer_PackStructured(buffer, msg->rtTime, group, value);
|
||||
if (SUCCEEDED(hr)) hr = IDirectMusicPort_PlayBuffer(port, buffer);
|
||||
IDirectMusicBuffer_Release(buffer);
|
||||
}
|
||||
|
||||
IDirectMusicPort_Release(port);
|
||||
break;
|
||||
}
|
||||
|
||||
case DMUS_PMSGT_NOTIFICATION:
|
||||
{
|
||||
DMUS_NOTIFICATION_PMSG *notif = (DMUS_NOTIFICATION_PMSG *)msg;
|
||||
|
|
Loading…
Reference in a new issue