Re: MIDI source unique IDs (was Names for MIDI sources)
Re: MIDI source unique IDs (was Names for MIDI sources)
- Subject: Re: MIDI source unique IDs (was Names for MIDI sources)
- From: Pete Yandell <email@hidden>
- Date: Wed, 13 Feb 2002 10:12:13 +1100
On Tuesday, February 12, 2002, at 03:02 PM, Doug Wyatt wrote:
In OMS the recommended practice was for apps to bind to both uniqueID's
and names, so that you could tolerate either of them changing. In OMS
(going from memory, not looking at the spec) I think you could provide
a hint as to what you wanted your virtual node's uniqueID to be, but
you wouldn't always get it -- there was the same potential for
something else having come along and grabbed the same uniqueID.
This discussion is making me think we should just add a UUID property
for nodes and be done with the problem that way.
Well, the OMS way doesn't sound very nice. Putting the onus on apps to
try matching on two methods is asking for trouble, not to mention
duplicating code.
UUIDs would solve the problem quite nicely, but it seems overkill. And
given that there is already the unique ID interface I would think it
made more sense to simply make this work properly than implement an
entirely new interface.
So, here's my humble opinion on how it should work:
When an app first creates a source, that source should get a system
allocated unique ID. (Apparently this is supposed to happen, but the
current version of CoreMIDI has a bug.)
The app can save that unique ID and, when restarted, request that unique
ID back again. The current method of setting the unique ID of the
source after creating works fine for this.
When the app quits, the source should basically be treated as a piece of
offline hardware.
There should be an API to get a source from a unique ID, which will
return offline sources as well as online ones. That way an app that
saves a unique ID for a source that goes offline can still get
properties for that source (the name in particular) and can flag it is
offline in the UI rather than treating it as entirely nonexistent.
Thoughts? I think doing things this way makes everything very clean
from the programmer's perspective, and it shouldn't be hard to implement
(in theory anyway.)
Now a question: do offline devices hang around in the device tree
forever, get reset on reboots, timeout after a certain time...?
Pete Yandell
http://pete.yandell.com/
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________
_______________________________________________
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.