I know that JUCE has the
AudioBuffer class, however I need a class with slightly more options for my application. Core requirements are
- It needs to be able to deal with complex valued samples as well as real valued samples
- For some special embedded FPGA-based targets, some shared memory between CPU and FPGA should be allocated through the buffer class instead of normal memory allocation, furthermore memory access through raw pointers needs some additional calls in this case
So in the end I would end up with at least with four different class variations (Real valued, standard memory; complex valued, standard memory; real valued, shared memory; complex valued, shared memory).
My first approach would be to create a pure virtual interface class and a subclass for all four variations. This way all DSP functions I would write just need to implement access through the base class member functions. However I’m not sure if this approach would prevent the compiler from perfect optimization such as inlining etc. if all functions such as the typical
getReadPointer, etc. would be virtual functions of the base class (as the actual class is evaluated at runtime, isn’t it?).
Any experts out here that could share some insight on how the performance impact of such a design could be or maybe if I shouldn’t bother at all because the impact is negligible? Or any good idea for a better design?