Re: Obj C and C with CoreMidi
Re: Obj C and C with CoreMidi
- Subject: Re: Obj C and C with CoreMidi
- From: Craig Bakalian <email@hidden>
- Date: Thu, 1 Jan 2004 09:44:36 -0500
On Dec 31, 2003, at 3:34 PM, Kurt Revis wrote:
Nonsense. There is an easier way to do it, without any static
objects. Just pass in your Objective-C object as the refCon to
MIDIInputPortCreate(). (If necessary, you can also use another object
as the connRefCon in MIDIPortConnectSource() -- if you don't need it
just use NULL.) Both of these objects will be given to your
MIDIReadProc, at which time you can cast them to the appropriate type,
and send Objective-C messages to them.
I'm sure code like this has been posted to the list before, but here
it goes again. Let's assume you have an Obj-C class which takes MIDI
input -- we'll call it MyPortRelatedObject. It creates an input port
and then connects one or more endpoints to that port.
(There is also a class called MyConnectionRelatedObject which contains
the information your application needs to know about the connection --
that is, the unique combination of input port and endpoint. There may
be any number of these for each instance of MyPortRelatedObject. You
might not need this at all in a simple application. I usually use
these to hold a MIDI input parser object, so the state of the parser
for each connected endpoint is independent of all the other
parsers/endpoints.)
Well, you learn something new everyday. Thanks Kurt!
Craig Bakalian
www.eThinkingCap.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.