I'm working on an audio-intensive app for the iPhone. I'm currently calling a number of different functions for each sample I need to calculate. For example, I have an envelope class. When I calculate a sample, I do something like:
sampleValue = oscilator->tic() * envelope->tic();
But I could also do something like:
for(int i = 0; i < bufferLength; i++){
buffer[i] = oscilatorBuffer[i] * evelopeBuffer[i];
}
I know the second will be more efficient, but don't know by how much. Are function calls expensive enough that I'd be crazy not to use buffers if I care event a tiny bit about performance?