I've found myself with a mysterious bug on my hands. Whenever I stop playback in my DAW (Logic 9), I instantly get all kinds of nasty buffer noise (as in, noise that has an audible pitch of frequency buffer_size/sample_rate). Sometimes this noise decays to zero (sounds like a Karplus-Strong string), other times it is constant, and other times it seems to grow exponentially. My effect is stateful and has a tail, in much the same way a reverb does.
My best theory of what's going on is that Logic sees that I have stopped playback and thinks that it no longer needs to do anything with the buffer that is being delivered to the processBlock() callback, so it doesn't even zero it out (this seems broken if it is the case). Therefore, I get the effect tail that I produced in the previous callback as input, and the way I process on it determines whether this feedback is stable or not.
First off, have others encountered this? Is this crazy?
Are there any guarantees on the buffer that we get from processBlock() when audio is stopped?
Is this behavior consistent across DAWs?
Do DAWs fade out before they tell the plugin that they have stopped?
EDIT: It is perhaps relevant that I am getting the audio by sidechaining (which I am doing entirely within logic, I didn't do anything to indicate that in the Jucer). I just saw http://www.juce.com/forum/topic/ultimate-juce-41-multibus-guide and will update this further if it mentions similar issues.