Re: MIDIConstants.kMIDIPropertyName
Re: MIDIConstants.kMIDIPropertyName
- Subject: Re: MIDIConstants.kMIDIPropertyName
- From: Luke Bellandi <email@hidden>
- Date: Thu, 26 Sep 2002 14:07:42 -0700
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.