render callback timing
render callback timing
- Subject: render callback timing
- From: Josh Anon <email@hidden>
- Date: Thu, 04 Mar 2004 16:01:37 -0800
Hi,
I'm trying to port a library for sync sound (to video) to the Mac.
I've got a ring buffer setup that I write into, and in the core audio
render callback, I read from there and copy it into the output buffer.
In my configure method, I set the audio device buffer size to
(UInt32)((10.0/1000.0 * rate * _bytesPerSample) + .5); to get 10ms of
audio. I also keep a listener for if the buffer size changes to set it
back to that.
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.
However, I've got some weird things going on. If I keep track of how
frequently the render callback is called, I would expect it to vary as
the device buffer size varies. However, it's always about 2494338ns,
or 1/2 as often as I would expect.
This might also be part of another problem--I have a test app which
gets the current time, adds a small increment, plays silence until
then, and then gets the next play time. On Linux with OSS, this gives
< 2 audio frame differences consistently, but with CoreAudio, it varies
from 50 - 2000 frames.
Any ideas? Thanks!
Josh
---
Josh Anon
Studio Tools, Pixar Animation Studios
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.