I'm a complete novice at this, but I thought I'd take a stab anyway. In the above example, could you have three separate buffers as like an intermediate processing stage? For example, as the interleaved buffer is read, it puts all the A things into the first buffer, the Bs into the second and so on. At the end, it concatenates the three buffers to produce your output.
I have no idea if I'm understanding the problem correctly...I'm looking forward to learning something here too :).
Hmmm...just a question though. Let's say I have a BufferLen of 9, NumOfChannels of 3, with audioBuffer like this:
1 4 7 2 5 8 3 6 9
The corresponding outBuffer should be:
1 2 3 4 5 6 7 8 9
Now, when your 'for' loop starts, it puts audioBuffer[0] into outBuffer[0]. Good so far. The next iteration puts audioBuffer[1] into outBuffer[4]. That's not correct! It should put it into outBuffer[3], right?
Actually, I have to say I still don't understand what this means practically. Does that mean that a [1] means that 'something' should sample channel 1, [2] means it should sample channel 2 etc? I'd love it if you could spare the time to give me a real-world example...