• 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: render callback timing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: render callback timing


  • Subject: Re: render callback timing
  • From: David Duncan <email@hidden>
  • Date: Fri, 5 Mar 2004 13:23:07 -0500

On Mar 5, 2004, at 12:36 PM, Josh Anon wrote:

In the callback, I also store the next play time in nanoseconds
(AudioConvertHostTimeToNanos) and, when asked, add that to device +
stream latency in nanos and return it as the next play time.

I'm not sure I follow what you are trying to accomplish here. What time
stamps are you using and for what purpose?
The idea is that the guy using this object can ask for the next play time in terms of system ticks--as close as possible to when the user will hear the sound. In configure, I ask for the device and stream latencies, and I register an observer for if they change. At the end of the render callback, I do this:

_nextPlayTime = AudioConvertHostTimeToNanos(((AudioTimeStamp*)inTimeStamp)- >mHostTime);

In the GetNextPlayTime method, I convert the device + stream latencies to nanoseconds, I get the nanoseconds per tick, I add the next play time + latency, and I return the ticks.

Unless I'm mistaken, the time handed to you in the AudioTimeStamp is when the HAL believes that the sound will be played on the device. From CoreAudio/AudioHardware.h:

"The time stamp for theInputData represents when the data was recorded. For the output, the time stamp represents when the first sample will be played."

so you should probably not be adjusting for latency when determining what the next play time is.
--
Reality is what, when you stop believing in it, doesn't go away.
Failure is not an option. It is a privilege reserved for those who try.

David Duncan
_______________________________________________
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.


  • Follow-Ups:
    • Re: render callback timing
      • From: Josh Anon <email@hidden>
References: 
 >Re: render callback timing (From: Josh Anon <email@hidden>)

  • Prev by Date: CarbonPane resizing & hosts
  • Next by Date: Re: render callback timing
  • Previous by thread: Re: render callback timing
  • Next by thread: Re: render callback timing
  • Index(es):
    • Date
    • Thread