Newbie to Juce - and struggling to learn VST3. (VST2 seemed a lot easier!)
I am designing an envelope follower and have the envelope value defined as the variable “env” in PluginProcess.h as a “protected float”. The code is almost working - “env” is updated with new values during the processBlock loops - but I can’t seem to figure out how to make it HOLD its value between processBlock calls.
“Env” has to be initialized to 0.0 before the processing begins but I can’t to figure out WHERE to initialize it. If I initialize it inside processBlock, before the processing loops, it works - the envelope tracks the signal. HOWEVER, since the value is being reset to 0.0 in each processBlock, it doesn’t hold its value from one block to the next.
I have tried initializing “env” in the constructor, in PreparetoPlay, and several other places and when I do any of those things the code does NOT work - “env” takes on a value of 1.0 and stays there.
How is something like this normally done? Where should the variable “env” be declared and initialized to make it “remember” its latest value between processBlock calls?