Hi, I am working with AudioParameterFloats for plugin automation, based off of the tutorial here: 404 - Missing Page - JUCE
It seems strange to me that the tutorial recommends initializing AudioParameters via the new keyword, since in JUCE’s style guide it is clearly recommended to avoid using new except when absolutely necessary:
Do not use ‘new’ unless there’s no alternative. Whenever you type ‘new’, always treat it as a failure to find a better solution. If a local variable can be allocated on the stack rather than the heap, then always do so.
Therefore instead of:
addParameter (gain = new AudioParameterFloat (“gain”, // parameter ID
“Gain”, // parameter name
0.0f, // mininum value
1.0f, // maximum value
0.5f)); // default value
I wanted to do:
private:
AudioParameterFloat time = AudioParameterFloat (“time”, “Time”, 0.1f, 1.0f, 1.0f);
and
addParameter(&time); //in constructor
But I get the error:
Call to deleted constructor of ‘juce::AudioParameterFloat’
What is causing this issue, and is there some reason that the new keyword should be used in this circumstance?