useful return values for Audio Unit callbacks?
useful return values for Audio Unit callbacks?
- Subject: useful return values for Audio Unit callbacks?
- From: Rick Sustek <email@hidden>
- Date: Thu, 16 Mar 2006 18:06:09 -0800
Hi gang,
The API docs have scant mention of return values, for the Audio Unit
callback functions.
I am particularly interested in the _SetRenderCallback. This is
usually shown as needing to return an OSStatus. We would normally
return a 'noErr' to indicate everything is puppies and bunnies.
However, I have seen in some Apple example code, a '-1' being
returned, to indicate foul creatures instead. The comments in this
sample code says this will cause "silence". (see ComplexPlayThru
example)
Indeed, in my testing, a return value of '-1' produces silence, when
used with the Apple Default Output Audio Unit.
However, other narrative in the docs suggest that to produce silence,
one should zero-fill the provided buffer, and set the
_OutputIsSilence flag in the ActionFlags, and (presumably) return
with a 'noErr'.
Observe that simply returning a '-1' is much more efficient than
taking the time to zero-fill a buffer, especially when long periods
of silence are to be emitted, like when the application has nothing
to do, but hasn't stopped the Audio Unit chain.
Comments or clarifications greatly appreciated!
Thanks,
Have fun,
-Rick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden