Re: finding midi device Endpoints by External Devices names?
Re: finding midi device Endpoints by External Devices names?
- Subject: Re: finding midi device Endpoints by External Devices names?
- From: Pete Yandell <email@hidden>
- Date: Thu, 12 Feb 2004 12:01:14 +1100
Ken,
kMIDIPropertyConnectionUniqueID isn't a string property, it's a data
property; and it's a property of endpoints (as returned by
MIDIGetSource or MIDIGetDestination), not of devices (returned by
MIDIGetDevice).
CFDataRef externalIDs;
OSStatus result;
result = MIDIObjectGetDataProperty (
midiEndpointRef, kMIDIPropertyConnectionUniqueID, &externalIDs
);
// If we do have external devices, grab all their names and glue
them together
if (result == noErr) {
int i;
for (i = 0; i < CFDataGetLength (externalIDs); i += 4) {
SInt32 externalID;
CFDataGetBytes (externalIDs, CFRangeMake (i, 4),
(UInt8*)&externalID);
...
}
CFRelease (externalIDs);
}
Of course any given endpoint may not have an external device attached,
in which case the initial MIDIObjectGetDataProperty will return an
error.
Pete Yandell
http://pete.yandell.com/
On 12/02/2004, at 10:46 AM, Ken Hawkins wrote:
>
well i am still stuck;
>
>
>
CFStringRef pname, pmanuf, pmodel, puID;
>
>
n = MIDIGetNumberOfDevices();
>
MIDIDeviceRef dev = NULL;
>
for (i = 0; i < n; ++i) {
>
dev = MIDIGetDevice(i);
>
>
MIDIObjectGetStringProperty(dev, kMIDIPropertyName, &pname);
>
MIDIObjectGetStringProperty(dev, kMIDIPropertyManufacturer, &pmanuf);
>
MIDIObjectGetStringProperty(dev, kMIDIPropertyModel, &pmodel);
>
MIDIObjectGetStringProperty(dev, kMIDIPropertyConnectionUniqueID,
>
&puID);
>
...
>
>
tells me in the debugger that puID that is supposed to hold the value
>
for kMIDIPropertyConnectionUniqueID is always out of scope and hold
>
(0x0) for these calls.
>
>
this happens with all my devices that are connected and whether it is
>
using MIDIGetDevice(i) or MIDIGetExternalDevice(i) calls.
>
>
everything else works great. except......
>
>
thanks,
>
ken;
>
>
On Feb 11, 2004, at 1:29 PM, Luke Bellandi wrote:
>
>
> Hi Ken,
>
>
>
>> i am unclear as to how to connect to the device that i want to send
>
>> it
>
>> packets of midi data. how can i connect to the endpoint of a SPECIFIC
>
>> midi device and send it data?
>
>
>
> You can't interface with external devices directly. Assuming you've
>
> got your MIDI Setup characterized correctly in Audio MIDI Setup (i.e.,
>
> you've added your external devices, and made the appropriate
>
> connections to your MIDI Interfaces), take the following steps to do
>
> what you're asking:
>
>
>
> 1) For the particular endpoint on the external device you're
>
> interested in, get property kMIDIPropertyConnectionUniqueID to find
>
> out what it's connected to.
>
> 2) Use the MIDIObjectFindByUniqueID(...) API on the UniqueID you just
>
> got to find the interface object it's connected to.
>
> 3) Send MIDI Data to *that* object.
>
>
>
> MIDI I/O can only be done with MIDI Devices, not External Devices.
>
>
>
> Best,
>
> Luke
>
> _______________________________________________
>
> coreaudio-api mailing list | email@hidden
>
> Help/Unsubscribe/Archives:
>
> http://www.lists.apple.com/mailman/listinfo/coreaudio-api
>
> Do not post admin requests to the list. They will be ignored.
>
_______________________________________________
>
coreaudio-api mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.