Hi all.
I'm thinking of a custom Audio analysis class that I want to create based on one of the existing FFT classes. So, I'd like this class to just inherit from AudioAnalyzeFFT1024. It would provide some functions of its own as well as calling functions from the base class. Will the inheritance structure shown in the code below work? I've only provided one (admittedly contrived) new method just for illustration. The real class would be more substantial.
Next question: What if I wanted to derive a new class from an Audio Library class that also has an output that can be connected to other objects (such as a filter)? Is there any way to "intercept" data from the 'transmit(block)' function of the base class, processes it further in the derived class and then 'transmit' it for real to the other objects via the defined AudioConnection?
Thanks.
I'm thinking of a custom Audio analysis class that I want to create based on one of the existing FFT classes. So, I'd like this class to just inherit from AudioAnalyzeFFT1024. It would provide some functions of its own as well as calling functions from the base class. Will the inheritance structure shown in the code below work? I've only provided one (admittedly contrived) new method just for illustration. The real class would be more substantial.
Code:
#include "Audio.h"
class myAnalysis : public AudioAnalyzeFFT1024 {
public:
myAnalysis() : AudioAnalyzeFFT1024() {}
bool myAvailable() {
bool ready = false;
bool b = AudioAnalyzeFFT1024::available();
// Do other stuff
// ready = someFunctionOf(otherStuff, b);
return ready;
}
};
AudioInputI2S i2s1;
AudioMixer4 mixer1;
myAnalysis analysis1;
AudioConnection patchCord1(i2s1, 0, mixer1, 0);
AudioConnection patchCord2(i2s1, 1, mixer1, 1);
AudioConnection patchCord3(mixer1, analysis1);
void setup() {}
void loop() {}
Next question: What if I wanted to derive a new class from an Audio Library class that also has an output that can be connected to other objects (such as a filter)? Is there any way to "intercept" data from the 'transmit(block)' function of the base class, processes it further in the derived class and then 'transmit' it for real to the other objects via the defined AudioConnection?
Thanks.