mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 22:34:14 +00:00
winecoreaudio.drv: Implement MIDIOut_Data when device is a MOD_MIDIPORT.
Implement MIDIOut_Send.
This commit is contained in:
parent
dea9878c2d
commit
622ee1c4cc
|
@ -26,6 +26,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(midi);
|
|||
|
||||
#ifdef HAVE_COREAUDIO_COREAUDIO_H
|
||||
#include <CoreMIDI/CoreMIDI.h>
|
||||
#include <mach/mach_time.h>
|
||||
|
||||
#include "coremidi.h"
|
||||
|
||||
|
@ -72,4 +73,16 @@ void MIDIIn_ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefC
|
|||
packet = MIDIPacketNext(packet);
|
||||
}
|
||||
}
|
||||
|
||||
void MIDIOut_Send(MIDIPortRef port, MIDIEndpointRef dest, UInt8 *buffer, unsigned length)
|
||||
{
|
||||
Byte packetBuff[512];
|
||||
MIDIPacketList *packetList = (MIDIPacketList *)packetBuff;
|
||||
|
||||
MIDIPacket *packet = MIDIPacketListInit(packetList);
|
||||
|
||||
packet = MIDIPacketListAdd(packetList, sizeof(packetBuff), packet, mach_absolute_time(), length, buffer);
|
||||
if (packet)
|
||||
MIDISend(port, dest, packetList);
|
||||
}
|
||||
#endif /* HAVE_COREAUDIO_COREAUDIO_H */
|
||||
|
|
|
@ -76,6 +76,8 @@ extern MIDIClientRef CoreMIDI_CreateClient(CFStringRef name);
|
|||
extern void CoreMIDI_GetObjectName(MIDIObjectRef obj, char *name, int size);
|
||||
extern void MIDIIn_ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon);
|
||||
|
||||
extern void MIDIOut_Send(MIDIPortRef port, MIDIEndpointRef dest, UInt8 *buffer, unsigned length);
|
||||
|
||||
/* midi.c */
|
||||
void MIDIIn_SendMessage(MIDIMessage msg);
|
||||
|
||||
|
|
|
@ -303,10 +303,6 @@ static DWORD MIDIOut_Open(WORD wDevID, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
|
|||
return MMSYSERR_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FIXME("MOD_MIDIPORT\n");
|
||||
}
|
||||
dest->wFlags = HIWORD(dwFlags & CALLBACK_TYPEMASK);
|
||||
dest->midiDesc = *lpDesc;
|
||||
|
||||
|
@ -326,8 +322,6 @@ static DWORD MIDIOut_Close(WORD wDevID)
|
|||
|
||||
if (destinations[wDevID].caps.wTechnology == MOD_SYNTH)
|
||||
SynthUnit_Close(destinations[wDevID].graph);
|
||||
else
|
||||
FIXME("MOD_MIDIPORT\n");
|
||||
|
||||
destinations[wDevID].graph = 0;
|
||||
destinations[wDevID].synth = 0;
|
||||
|
@ -344,10 +338,7 @@ static DWORD MIDIOut_Close(WORD wDevID)
|
|||
static DWORD MIDIOut_Data(WORD wDevID, DWORD dwParam)
|
||||
{
|
||||
WORD evt = LOBYTE(LOWORD(dwParam));
|
||||
WORD d1 = HIBYTE(LOWORD(dwParam));
|
||||
WORD d2 = LOBYTE(HIWORD(dwParam));
|
||||
UInt8 chn = (evt & 0x0F);
|
||||
OSStatus err = noErr;
|
||||
|
||||
TRACE("wDevID=%d dwParam=%08X\n", wDevID, dwParam);
|
||||
|
||||
|
@ -356,10 +347,12 @@ static DWORD MIDIOut_Data(WORD wDevID, DWORD dwParam)
|
|||
return MMSYSERR_BADDEVICEID;
|
||||
}
|
||||
|
||||
TRACE("evt=%08x d1=%04x d2=%04x (evt & 0xF0)=%04x chn=%d\n", evt, d1, d2, (evt & 0xF0), chn);
|
||||
|
||||
if (destinations[wDevID].caps.wTechnology == MOD_SYNTH)
|
||||
{
|
||||
WORD d1 = HIBYTE(LOWORD(dwParam));
|
||||
WORD d2 = LOBYTE(HIWORD(dwParam));
|
||||
OSStatus err = noErr;
|
||||
|
||||
err = MusicDeviceMIDIEvent(destinations[wDevID].synth, (evt & 0xF0) | chn, d1, d2, 0);
|
||||
if (err != noErr)
|
||||
{
|
||||
|
@ -367,7 +360,15 @@ static DWORD MIDIOut_Data(WORD wDevID, DWORD dwParam)
|
|||
return MMSYSERR_ERROR;
|
||||
}
|
||||
}
|
||||
else FIXME("MOD_MIDIPORT\n");
|
||||
else
|
||||
{
|
||||
UInt8 buffer[3];
|
||||
buffer[0] = (evt & 0xF0) | chn;
|
||||
buffer[1] = HIBYTE(LOWORD(dwParam));
|
||||
buffer[2] = LOBYTE(HIWORD(dwParam));
|
||||
|
||||
MIDIOut_Send(MIDIOutPort, destinations[wDevID].dest, buffer, 3);
|
||||
}
|
||||
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue