Re: MIDI notifications?
Re: MIDI notifications?
- Subject: Re: MIDI notifications?
- From: Kurt Revis <email@hidden>
- Date: Sun, 13 Jan 2002 13:39:33 -0800
On Sunday, January 13, 2002, at 01:09 PM, Stephen Davis wrote:
I'm trying to handle a MIDI interface showing up or going away and I
thought registering a MIDINotifyProc() during client creation would get
me such a notification. In the normal case I don't. Caveat: I'm using
a MIDIMAN MIDISport 1x1 and the driver seems pretty buggy so I just
want to know whether or not I _should_ be getting notifications when it
comes and goes.
The driver is buggy. Hotplugging it doesn't work very well, if at all.
With a driver that does support hotplugging (like the current MOTU
driver) you get the same kinds of notifications as you get when virtual
sources/destinations are created and destroyed.
I do get a notification when another app creates a virtual source (5
messages in fact) and subsequently destroys that virtual source (1
notification) but not when the MIDISport comes and goes.
You are seeing multiple notifications because they are sent not only
when the source is created, but also when some of its properties are
changed. I don't recall right now if this happens when any property is
changed, or just certain ones. I know it happens when the unique ID of
the endpoint is set.
Also note that your notification handler needs to be reentrant, because
you may get notified while you are in the middle of handling a
notification. In my case, when I got a notification, I went through and
found all the available sources and destinations; however, when I called
things like MIDIGetNumberOfSources(), the run loop got run again, and
another notificatiion could be delivered before that function returned.
This is annoying, but not impossible to deal with.
--
Kurt Revis
email@hidden