ddraw: Use wined3d_get_adapter_display_mode() in d3d_device7_EnumTextureFormats().
[wine/multimedia.git] / dlls / winecoreaudio.drv / coremidi.c
blob173341870c556ef07e6c8e6f8b1105877d5c87d3
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 #include <CoreMIDI/CoreMIDI.h>
25 #include <mach/mach_time.h>
27 #include "coremidi.h"
30 MIDIClientRef CoreMIDI_CreateClient(CFStringRef name)
32 MIDIClientRef client = NULL;
34 if (MIDIClientCreate(name, NULL /* FIXME use notify proc */, NULL, &client) != noErr)
35 return NULL;
37 return client;
40 void CoreMIDI_GetObjectName(MIDIObjectRef obj, char *name, int size)
42 OSStatus err = noErr;
43 CFStringRef cfname;
45 err = MIDIObjectGetStringProperty(obj, kMIDIPropertyName, &cfname);
46 if (err == noErr)
48 CFStringGetCString(cfname, name, size, kCFStringEncodingASCII);
49 CFRelease(cfname);
54 * CoreMIDI IO threaded callback,
55 * we can't call Wine debug channels, critical section or anything using NtCurrentTeb here.
57 void MIDIIn_ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon)
59 unsigned int i;
60 MIDIMessage msg;
62 MIDIPacket *packet = (MIDIPacket *)pktlist->packet;
63 for (i = 0; i < pktlist->numPackets; ++i) {
64 msg.devID = *((UInt16 *)connRefCon);
65 msg.length = packet->length;
66 memcpy(msg.data, packet->data, sizeof(packet->data));
68 MIDIIn_SendMessage(msg);
70 packet = MIDIPacketNext(packet);
74 void MIDIOut_Send(MIDIPortRef port, MIDIEndpointRef dest, UInt8 *buffer, unsigned length)
76 Byte packetBuff[512];
77 MIDIPacketList *packetList = (MIDIPacketList *)packetBuff;
79 MIDIPacket *packet = MIDIPacketListInit(packetList);
81 packet = MIDIPacketListAdd(packetList, sizeof(packetBuff), packet, mach_absolute_time(), length, buffer);
82 if (packet)
83 MIDISend(port, dest, packetList);