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: Thu, 18 Mar 2004 08:52:52 -0500
On Mar 18, 2004, at 05:15 AM, Alberto Ricci wrote:
Suppose I want to play some data - which is generated in real time -
through the default output unit. Such data is generated at an
approximate rate of 44100 samples per second, but some frames may be
skipped every once in a while (just a few samples here and there,
resulting in an effective average rate of 44099.9 Hz or so), so my
Render callback wouldn't know what samples to generate in those cases
in order to ensure a precise 44100 Hz rate.
Are you talking about a HAL callback or an Audio Unit callback? The
provided Audio Output Units arrange so that you are always requested a
number of frames that ensure a consistent sample rate (this is not the
same as always requesting the same number of samples).
What should my Render callback do in such situations? Always return
the requested number of frames, no matter what, therefore filling the
gaps with silence (or with the last frame's value)? Or can it return a
smaller amount of samples and have CoreAudio properly handle that?
You should always return the number of frames requested, and in fact
you must do so for Audio Units (because there is no mechanism to do
otherwise). Don't fill gaps with silence unless you really intend to
play silence.
Do you have a specific issue that is causing you to ask about this?
--
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.