One thing I noticed from your code is that it looks like you're only computing one sample in your perform function. I think you should be looping through every sample in the block. That's what you pass "n" or whatever the value is to the function.
I have a little while (n--) thing going in the perform function. Do I have the pointers set right at the beginning of the function?
Thanks for the reply
-pdman "lever, pull"