For some time I have been using my own template version of the IIRFilter class so that I can pass floats or doubles to my processBlock(). Recently, I have begun to move over to the new dsp classes and wish to accomplish the same thing, which I thought would be easy since the dsp classes are already template classes. But I am having trouble figuring out the right way to declare the initial member variables.
Thank you. That is what one would think should work, but it does not compile. At least, it does not compile in VS2017! The error is “only static data member templates are allowed”.
1>c:\aaxprojects2\Plugin\source\PluginProcessor.h(111): error C3376: 'PluginProcessor::chain': only static data member templates are allowed (compiling source file ..\..\Source\PluginEditor.cpp)
1>c:\aaxprojects2\Plugin\source\PluginProcessor.h(111): error C3376: 'PluginProcessor::chain': only static data member templates are allowed (compiling source file ..\..\Source\PluginProcessor.cpp)
1>..\..\Source\PluginProcessor.cpp(32): error C3245: 'PluginProcessor::chain': use of a variable template requires template argument list
1>c:\aaxprojects2\Plugin\source\PluginProcessor.h(111): note: see declaration of 'PluginProcessor::chain'
I am just not seeing how to form the syntax…your help is greatly appreciated!
Disclaimer: I am not familiar with these classes, so I might say something stupid. My solutions are only “correct” from the C++ POV, but there are maybe not correct for JUCE, or for what you want to achieve.
chain cannot be of type dsp::ProcessorChain<GainProcessor, FilterProcessor>, because GainProcessor and FilterProcessor are not types. GainProcessor<double>, GainProcessor<float>, FilterProcessor<double> and FilterProcessor<float> are types.
If you want chain to be either a dsp::ProcessorChain<GainProcessor<double>, FilterProcessor<double>> or a dsp::ProcessorChain<GainProcessor<float>, FilterProcessor<float>>, then I guess you have to make PluginAudioProcessor a class template.