I am writing a beatbox sequencer for the iphone using CoreAudio.
I have 4 sounds that play on a pattern. I have a AUGraph with IORemote and MultiChannelMixer together. The 4 inputs of the mixer have a callback reading the sound buffers attached to it. It works fine as long as long as sequencer pattern is simple and does not play too many sounds at the same time. If I turn on multiple sounds at the same time, glitches appear and it sound like the CPU is overloaded (I am using an iPhone 1st gen for testing).
size_t bytesPerSample = sizeof (AudioUnitSampleType);
stereoStreamFormat.mFormatID = kAudioFormatLinearPCM;
stereoStreamFormat.mFormatFlags = kAudioFormatFlagsAudioUnitCanonical;
stereoStreamFormat.mBytesPerPacket = bytesPerSample;
stereoStreamFormat.mFramesPerPacket = 1;
stereoStreamFormat.mBytesPerFrame = bytesPerSample;
stereoStreamFormat.mChannelsPerFrame = 2; // 2 indicates stereo
stereoStreamFormat.mBitsPerChannel = 8 * bytesPerSample;
stereoStreamFormat.mSampleRate = GRAPH_SAMPLE_RATE;