• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Timestamp from a midipacket?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Timestamp from a midipacket? (From: "Vigour Vigour" <email@hidden>)

  • Prev by Date: Re: AUCarbonViewControl::ControlToParameter and ParameterToControl
  • Next by Date: More mysterious error codes...
  • Previous by thread: Timestamp from a midipacket?
  • Next by thread: Forcing AU window to redraw
  • Index(es):
    • Date
    • Thread