I found the problem with the distortion. I was using inSourceP and not sourceP:
void TestAudioUnit::TestAudioUnitKernel::Process(Float32 const* inSourceP, Float32 * inDestP, UInt32 inFramesToProcess, UInt32 inNumChannels, bool & ioSilence) {
if (!ioSilence) {
const Float32 *sourceP = inSourceP;
...
But at the end of the loop, I was incrementing sourceP. So as far as I understand, I was essentially downsampling everything by the buffer size (512), by not incrementing the value that I was getting the source from.
And for debugging, I found that if I have Xcode launch AU Lab, it will break at breakpoints, etc. I followed the steps here for that:
I am not sure where printf() statements are going, but I should be able to find the console when I need it. In the meantime, the breakpoints and being able to inspect variables that way is almost more helpful.
I am curious which wave editor you are using. I would like to automate some sort of process so that I can build and run and it will automatically run against a particular audio file and show me the before and after waveforms. Is there a lightweight application that will help me do that?
Thanks for your help,
Chaim