Actually, this is better, but still not right:
public void ProcessBlock(float[] samples, int numChannels)
{
//print(channelSamples.Length);
for (int i = 0; i < samples.Length; i += numChannels, ksmpsIndex++)
{
for (uint channel = 0; channel < numChannels; channel++)
{
if (ksmpsIndex >= csoundUnity.GetKsmps())
{
channelSamples = csoundUnity.GetAudioChannel(csoundChannels[0]);
ksmpsIndex = 0;
}
samples[i + channel] = (float)channelSamples[ksmpsIndex];
}
}
}