Re: MIDI processing question
Re: MIDI processing question
- Subject: Re: MIDI processing question
- From: Kurt Revis <email@hidden>
- Date: Fri, 2 Apr 2004 00:51:37 -0800
On Thursday, April 1, 2004, at 03:46 AM, Kent Clelland wrote:
when I receive MIDIPacketLists in my ReadProc() I am _expecting_ that
they are sorted in timestamp - ascending order.
I agree that this is a reasonable expectation.
Note that the timestamps are set by the code that creates the whole
MIDI packet and gives it to the MIDIServer. As far as I know, the
MIDIServer does very little (perhaps no) processing of the timestamps
-- it just passes the packets through. So you're at the mercy of
whoever's generating the MIDI data -- either a MIDI driver or another
application.
Also, I wouldn't be surprised if some applications ignore the
timestamps on incoming MIDI data, and instead make their own timestamps
(based on the current host time when they receive the packets). These
apps would appear to work, even if the driver-generated timestamps were
wrong. I wouldn't *recommend* that anyone ignore the timestamps, since
it means throwing away one of the primary advantages of CoreMIDI, but
it wouldn't amaze me if people actually do (since the difference could
be fairly subtle, especially on a fast and lightly-loaded machine).
HOWEVER, what I am _experiencing_ is that I am in fact recieving
events in the MIDIPacketList sometimes in ascending order and
sometimes in descending, and I *guess* I will someday maybe get some
in an arbitrary order.
I haven't seen this before, but I guess there's a first time for
everything. Seems like there are two possibilities:
1) The packets (and the data in the packets) are in the right order,
but the timestamps are just wrong. Are the timestamps reasonably close
to the value you get from AudioGetCurrentHostTime()? They should be.
2) The timestamps for each packet are correct, but the packets are
getting put into MIDIPacketLists in the wrong order, or perhaps
delivered in the wrong order.
If you send some MIDI data, do you get it back in the same order? (Run
a cable from an output of your MIDI interface back to an input on the
same interface, send out some MIDI data, and see what you get back.)
some colleagues are of the opinion that because this seems to only
happen with one particular driver (at the moment) that the driver
"sucks" and there's not alot we can do about it. *HOWEVER* I
personally am of the opinion that since the documentation is not 100%
comprehensive it is a better idea to field the issue here in this
forum, because maybe on the other side of the sargasso they are saying
that those music apps "suck" because they don't sort their incoming
MIDI ...
I see your point. I don't know of any documentation that explicitly
answers this question. However, I can't think of any reasons why
allowing out-of-order packets would be a good idea. So that leads me
to think that it was just too obvious for anyone to remember to
document!
(But of course, I'm always happy to be proved wrong.)
--
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.