Re: Timestamp from a midipacket?
Re: Timestamp from a midipacket?
- Subject: Re: Timestamp from a midipacket?
- From: Chris Reed <email@hidden>
- Date: Wed, 29 Jan 2003 14:28:51 -0600
On Wednesday, Jan 29, 2003, at 04:48 US/Central, Vigour Vigour wrote:
How do I print (to the terminal) a timestamp from a midipacket? Any
code example?
Here's a snippet of code for printing timestamps:
// at some init point
Float64 ticksPerSecond = AudioGetHostClockFrequency();
Float64 ourStartTimeStamp = Float64(AudioGetCurrentHostTime()) /
ticksPerSecond;
// later
UInt64 nanos = AudioConvertHostTimeToNanos(packet->timeStamp);
Float64 secs = Float64(packet->timeStamp) / ticksPerSecond * 1000.;
if (relativeTimes)
secs -= ourStartTimeStamp;
printf(" [.14g ms]\n", secs);
As shown above, you might want to take a timestamp when your app starts
or at some other convenient place so you can print timestamps relative
to that point and makes the numbers a lot smaller and easier to read.
-chris
_______________________________________________
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.