Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: MIDITimeStamp ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MIDITimeStamp ?



Aha, I see.
The current documentation is something like a jigsaw puzzle to me.
If you know the whole picture then it's easy, but if you don't, it's a real puzzle.

It's very lucky that there are many people who already know the solutions,
but I'm really looking forward to have the upgraded documentation.

Thank you!
Joe.

On Wednesday, February 13, 2002, at 02:00 AM, Doug Wyatt wrote:
On Tuesday, February 12, 2002, at 08:59 , Joe Chang (l%l,m8) wrote:
<CoreMIDI/MIDIServices.h> says:
Since MIDI applications will tend to do a fair amount of
math with the times of events, it's more convenient to use a
UInt64 than an AbsoluteTime.

OK, but what is the format or unit (milliseconds?) of time-stamp in UInt64?

The paragraphs before the one you quoted:

@typedef MIDITimeStamp

@discussion A host clock time representing the time of an event, as
returned by AudioGetCurrentHostTime() (or UpTime()).

If I want to send a note-on message right now and note-off message after 1 second, what time-stamp values should I set for each MIDIPacket?

"Now" is most simply represented by a timestamp of 0.

The MIDITimeStamp for one millisecond from now is

const UInt64 kOneMillisecondOfNanos = 1000000;
MIDITimeStamp now = AudioGetCurrentHostTime();
MIDITimeStamp oneMillisecondFromNow = now +
AudioConvertNanosToHostTime(kOneMillisecondOfNanos);

Doug
_______________________________________________
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.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.