• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How does an external MIDI device differ from a "normal" device?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How does an external MIDI device differ from a "normal" device?


  • Subject: Re: How does an external MIDI device differ from a "normal" device?
  • From: Kurt Revis <email@hidden>
  • Date: Tue, 26 Aug 2003 01:42:57 -0700

On Monday, August 25, 2003, at 05:16 PM, Michael Norris wrote:

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.

However, this code always returns the follow error:
MIDIObjectGetIntegerProperty received an error: -10835

Which is not surprising. MIDIServices.h says that kMIDIPropertyOffline applies to [ordinary] devices, entities, and endpoints, not external devices. And sure enough, -10835 is kMIDIUnknownProperty, meaning that that property does not apply to the object you are asking about.

Also, if I check to see how many entities the external device has, it always returns 0.

I've never seen an external device which has any entities at all. I don't believe that Audio MIDI Setup has any way to create external devices which have entities associated with them. Generally only "real" devices (aka MIDI interfaces) have entities. (I see that the header allows for the possibility of "external entities" -- see kMIDIObjectType_ExternalEntity -- but I don't know of any cases where this is actually used right now.)

I'm obviously misunderstanding the different between the type of device returned by MIDIGetExternalDevice() and MIDIGetDevice()

If you run Audio MIDI Setup, it should be pretty obvious. "ordinary" devices are things like MIDI interfaces, which have entities and endpoints. They show up automatically when you plug in the device. External devices are the things that the user creates and configures in AMS. They don't appear unless the user puts them there.

When the header says "device", it means "ordinary device". When it says "external device", it means "external device". The two share a word but are otherwise distinct kinds of things. The name "external device" is kind of unfortunate because it leads to some confusion, but it's undoubtedly too late to change it now.

In general, in your program, you want to deal with "ordinary" devices and endpoints to actually get work done. You shouldn't assume that the user has created any external devices in AMS. If they have, great -- you can use this extra information to make a friendlier UI -- but the program should still work even without them.

If you want to find all the "online" external devices, I would suggest iterating through the list of devices (use MIDIGetNumberOfDevices() and MIDIGetDevice()). Check each device to see if it's online or offline. For each online device, get the value of kMIDIPropertyConnectionUniqueID, which will tell you the unique IDs of the external devices which are connected to that device. Then look up each external device using MIDIObjectFindByUniqueID(). (I haven't tried this myself lately, so it's possible that the device itself doesn't have all the connections -- you may have to get the device's entities or endpoints, and then ask *them* for kMIDIPropertyConnectionUniqueID. You should be able to figure this out with a little experimentation.)

--
Kurt Revis
email@hidden
_______________________________________________
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.

References: 
 >How does an external MIDI device differ from a "normal" device? (From: Michael Norris <email@hidden>)

  • Prev by Date: Re: here I am
  • Next by Date: Quicktime and CA audio decoders
  • Previous by thread: How does an external MIDI device differ from a "normal" device?
  • Next by thread: Quicktime and CA audio decoders
  • Index(es):
    • Date
    • Thread