Re: Render callback not producing enough samples
Re: Render callback not producing enough samples
- Subject: Re: Render callback not producing enough samples
- From: David Duncan <email@hidden>
- Date: Mon, 22 Mar 2004 10:48:46 -0500
On Mar 22, 2004, at 10:31 AM, Alberto Ricci wrote:
Thank you, David.
I was referring to an Audio Unit callback.
OK, I will then return the exact number of frames requested, but I
wonder what is best to do when I am requested more frames than I have
in my ring buffer. This ring buffer is filled by a piece of custom
hardware, so I can't just decide to process more samples.
In order to have as many samples as requested, I would need to sleep
until the device has generated more samples, but then I don't think
it's a good thing to do from within a realtime thread... or is it?
It's not good to sleep in a realtime thread. You really only have two
choices - arrange so that your external device always has enough
samples available, or hand out silence if there aren't enough. If you
can request the hardware to produce more samples while running, you can
try to detect when you will run out in the future and request it
prepare more samples, but that is probably the best you can do in
either case.
--
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.