Re: Use of the source refcon in MIDIProc callback
Re: Use of the source refcon in MIDIProc callback
- Subject: Re: Use of the source refcon in MIDIProc callback
- From: Kurt Revis <email@hidden>
- Date: Fri, 8 Nov 2002 16:39:28 -0800
On Friday, November 8, 2002, at 02:53 AM, Philippe Wicker wrote:
The MIDIProc callback receives a (void*) pointer as 3rd parameter
which is supposed to identify the source of the packet list.
Well, not exactly. It just gives you whatever value you passed in when
you called MIDIPortConnectSource(). If you want to distinguish between
events that come in through different source endpoints, you should give
each connection a different value for connRefCon.
For example, I have one instance of a MIDI parser class for each
connection. (The parser has some state associated with it, so it needs
to be a persistent object, and I can't share one across multiple source
endpoints.) In my midiReadProc, I use the srcConnRefCon to look up the
parser for that connection, and then hand off the packet list to the
parser.
Does that mean that packet lists send by different sources to the same
endpoint will never be merged in one packet list. In other words, can
we safely rely on the source refcon to, example given, filter midi
events according to the source?
I'm not sure exactly what you mean. If two clients simultaneously send
events to the same endpoint, the MIDIServer will merge the two streams
together. When you receive the events, there is no way to know who
sent them. You can use the srcConnRefCon to deduce which endpoint the
events are coming from, but that's all.
Does this help?
--
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.