On Sep 1, 2007, at 8:01 AM, Oliver Brodwolf wrote:
Hello
I don't know the english word for it. In German we call it Knackser, perhaps you call it pops.
Sometime in my coreaudio Application there is a Knackser, and after this, there is no sound anymore in the speakers.
The first part of my AUGraph is generating sound, but behind the 3dMixer there is no signal. Start ore stop the AUGraph creates new Knackser. But there is no chance to make the "Soundengine" work. When I start the application again, all is well again, until the first Knackser. In this case, if start the AUGraph, other sound-Apps can't generate Sound too.
1. What can be the reason for this Knackser?
This can happen if you introduce a +/-NaN or +/-inf into the output stream. The system, presumably for performance reasons, does not appear to protect against them so, once one makes it into the output stream, it gets "stuck" in a mix buffer or something and no further audio will come out. I'm not sure exactly what makes the whole system mute but suspect it is some clipping optimization that unsuccessfully turns the NaNs into a constant DC value.
For example, an optimized PPC sequence for clipping float values to +/-1 would be the use of the fsel instruction to do branchless selects between two values like the following sequence:
fsub temp,x,one
fsel x,temp,one,x // x = min( x, 1.0 )
fneg one,one
fsub temp,x,one
fsel x,temp,x,one // x = max( x, -1.0 )
However, when you feed a NaN into this code as the "x" value, you get -1 as the output. Depending on how everything is structured below the app, you might end up with a continuous stream of -1s as your output. Not silence per se but not audible either. :-)
Note that I am just speculating on why the output mutes in this situation but I've seen this happen b/c I had a bug in one of my decoders that produced a NaN under certain conditions and letting that NaN escape my app caused all the audio on the system to "mute". We tracked it down to the NaN and everything was fine after we prevented it.
2. How can I "Reset" the Soundengine without quit my application.
I'm not sure you can. I think you just have to prevent the NaN from getting generated in this first place.