include: Update some d3d10shader.h definitions.
[wine.git] / dlls / winecoreaudio.drv / coremidi.c
blobea7d2fd874356efe4522b911acf462f475dbfb3a
1 /*
2 * Wine Midi driver for Mac OS X
4 * Copyright 2006 Emmanuel Maillard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "config.h"
24 #ifdef HAVE_COREAUDIO_COREAUDIO_H
26 #include <CoreMIDI/CoreMIDI.h>
27 #include <mach/mach_time.h>
29 #include "coremidi.h"
32 MIDIClientRef CoreMIDI_CreateClient(CFStringRef name)
34 MIDIClientRef client = NULL;
36 if (MIDIClientCreate(name, NULL /* FIXME use notify proc */, NULL, &client) != noErr)
37 return NULL;
39 return client;
42 void CoreMIDI_GetObjectName(MIDIObjectRef obj, char *name, int size)
44 OSStatus err = noErr;
45 CFStringRef cfname;
47 err = MIDIObjectGetStringProperty(obj, kMIDIPropertyName, &cfname);
48 if (err == noErr)
50 CFStringGetCString(cfname, name, size, kCFStringEncodingASCII);
51 CFRelease(cfname);
56 * CoreMIDI IO threaded callback,
57 * we can't call Wine debug channels, critical section or anything using NtCurrentTeb here.
59 void MIDIIn_ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon)
61 unsigned int i;
62 MIDIMessage msg;
64 MIDIPacket *packet = (MIDIPacket *)pktlist->packet;
65 for (i = 0; i < pktlist->numPackets; ++i) {
66 msg.devID = *((UInt16 *)connRefCon);
67 msg.length = packet->length;
68 memcpy(msg.data, packet->data, sizeof(packet->data));
70 MIDIIn_SendMessage(msg);
72 packet = MIDIPacketNext(packet);
76 void MIDIOut_Send(MIDIPortRef port, MIDIEndpointRef dest, UInt8 *buffer, unsigned length)
78 Byte packetBuff[512];
79 MIDIPacketList *packetList = (MIDIPacketList *)packetBuff;
81 MIDIPacket *packet = MIDIPacketListInit(packetList);
83 packet = MIDIPacketListAdd(packetList, sizeof(packetBuff), packet, mach_absolute_time(), length, buffer);
84 if (packet)
85 MIDISend(port, dest, packetList);
87 #endif /* HAVE_COREAUDIO_COREAUDIO_H */