i'm trying to figure out how to arrange the audio processing in a plugin more efficiently.
A somewhat naive but fairly efficient way would use something like:
Code: Select all
struct Processor {
virtual void process(float* buf, int numFrames) = 0;
};
struct Gain : public Processor {
virtual void process(float* buf, int numFrames) {
input->process(buf, numFrames);
for (int i=0; i<numFrames; i++) {
buf[i] *= gain;
}
}
Processor* input;
float gain;
};
Now i know two ways to try to do this more efficiently. We could try to get rid of the nested virtual function calls and we could process multiple channels in parallel. Are there any other issues?
There is some previous discussion about the subject, but as usual it is impossible to estimate the significance of any given method, except after actually implementing and measuring. I would like to know if you have any thoughts, experience or advice?


