How does an external MIDI device differ from a "normal" device?
How does an external MIDI device differ from a "normal" device?
- Subject: How does an external MIDI device differ from a "normal" device?
- From: Michael Norris <email@hidden>
- Date: Tue, 26 Aug 2003 12:16:05 +1200
Hey there
I'm trying to write a routine which will check to see if any of the
MIDI devices attached to my computer are a) an actual note-producing
device attached via a MIDI-cable - e.g. a MIDI keyboard, and b) are
online.
Looking through the CoreMIDI docs, I thought that the code below would
be ideal:
OSStatus status;
int i,n, onlineSources;
MIDIDeviceRef theDevice;
SInt32 offline;
n = MIDIGetNumberOfExternalDevices();
for (i=onlineSources=0; i < n; i++) {
theDevice = MIDIGetExternalDevice(i);
// this callback always returns an error:
status = MIDIObjectGetIntegerProperty(theDevice,
kMIDIPropertyOffline,
&offline);
NSLog(@"kMIDIPropertyOffline: %i",offline);
if (status != noErr) NSLog(@"MIDIObjectGetIntegerProperty
received an error: %i",status);
if (!offline) {
onlineSources++;
// connect source etc.
}
}
if (onlineSources == 0) {
NSLog(@"No online external MIDI devices found.");
}
However, this code always returns the follow error:
MIDIObjectGetIntegerProperty received an error: -10835
Also, if I check to see how many entities the external device has, it
always returns 0.
Looking through the docs, I couldn't see any reason why I shouldn't be
allowed to query an external device for its online status, or why it
should return 0 entities...
I'm obviously misunderstanding the different between the type of device
returned by MIDIGetExternalDevice() and MIDIGetDevice()
Can anyone point me in the right direction?
-mike
_______________________________________________
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.