Re: MIDIConstants.kMIDIPropertyName
Re: MIDIConstants.kMIDIPropertyName
- Subject: Re: MIDIConstants.kMIDIPropertyName
- From: Doug Wyatt <email@hidden>
- Date: Fri, 27 Sep 2002 10:21:26 -0700
Luke, you're right ... except that the device's name property should be
getting inherited by any of its entities that don't have names ... and
then inherited by any endpoints that don't have names.
I am aware of a situation where the USB class driver puts a name of ""
on an entity, thus masking the device's name and making the endpoint
names also "". This happens on a class-compliant device (e.g.
Evolution keyboard) that only has one entity and will be fixed Soon. I
suspect this may be the underlying problem here. The best workaround
would be, if the endpoint's name is empty, walk upward to its entity
and then its device (MIDIEndpointGetEntity and MIDIEntityGetDevice were
added for 10.2) looking for a name. Pre-10.2 you have to build your
own representation of the device/entity/endpoint tree in order to walk
upward from an endpoint.
We don't recommend that apps enumerate the devices as their primary
means of locating endpoints. The device list contains offline and
private devices which need to be ignored. And only walking the device
list will result in your skipping virtual endpoints, which have no
associated entities or devices.
Doug
On Thursday, Sep 26, 2002, at 14:07 US/Pacific, Luke Bellandi wrote:
Craig,
CoreAudio Java simply wraps the C API's so your deployment
language is
of no consequence: even if you wanted to intermix the two it would work
fine.
Audio MIDI Setup (AMS) doesn't handle the MIDI system in terms of
sources and destinations (with respect to the API), but in terms of
Devices,
Entities, and Endpoints.
Granted, sources and destinations are endpoints. However, AMS is
less
interested in which endpoints it can output MIDI to, and more
interested in
how the structure of the MIDI system is setup (sort of has the inverse
interests of the programs most of you might write: sequencers, where
you
just need to know where MIDI is coming from and going to, rather than
how it
all looks on paper.)
MIDIConstants.kMIDIPropertyName applies to all MIDIObjects. So
for the
hierarchy MIDIDevice->MIDIEntity->MIDIEndpoint each object can have a
different name, and typically they do.
For an example device: the name property of the MIDIDevice object is
the
name of that device, we'll call it "my MIDI Interface". One of the
MIDIEntity objects of that MIDIDevice might be named "Port 1", and
since
often these entities are set up as a simple I/O pair (one source
endpoint
and one destination endpoint), there's really no need to provide a
name for
each endpoint.
It makes sense to propagate the Manufacturer string property to all
objects in that chain because all the objects belong to the device
that was
created by the one manufacturer, this is why you're getting a
manufacturer
string.
For what you're doing, you'll probably want to look up the chain a
bit
to get a string that would be interesting to the user.
If you have any interest in working in C, you can check out the
functions:
OSStatus MIDIEndpointGetEntity( MIDIEndpointRef inEndpoint,
MIDIEntityRef * outEntity);
And...
OSStatus MIDIEntityGetDevice( MIDIEntityRef inEntity,
MIDIDeviceRef
* outDevice);
And then get the name property for the device and/or entity, and use
that
string to name/label your endpoint.
In Java you should use the
Int MIDIDevice.getNumberOfDevices();
MIDIDevice MIDIDevice.getDevice(int index);
Methods, and traverse the hierarchy down through entities and
endpoints to
then match up your source/destination endpoints with their parent
devices
and those properties.
Best,
Luke Bellandi
CoreAudio
On 9/26/02 5:50 AM, "Craig Bakalian" <email@hidden> wrote:
Hi,
In my Apple Audio MIDI Setup I see my keyboard's name. However, this
is not returning a string for my application->
for(int i = 0; i < numSources; i++){
MIDIEndpoint dest = MIDISetup.getSource(i);
CAFString nameOfSource =
dest.getStringProperty(MIDIConstants.kMIDIPropertyName);
midiSources.put(nameOfSource.asString(), dest);
}
Yet, this is returning a string ->
for(int i = 0; i < numSources; i++){
MIDIEndpoint dest = MIDISetup.getSource(i);
CAFString nameOfSource =
dest.getStringProperty(MIDIConstants.kMIDIPropertyManufacturer);
midiSources.put(nameOfSource.asString(), dest);
}
I imagine that Audio MIDI Setup is written in C++, and I am writting
in
Java, is this a bug?
Craig Bakalian
_______________________________________________
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.
--
Doug Wyatt
work: email@hidden (CoreAudio)
personal: email@hidden
http://www.sonosphere.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.