Ok I am reopening this issue here. Since I implemented your suggestion, it has worked great. Now however I have restructured my synth, which worked great as a single instance, and replaced global variables to classes and using references and pointers. And doing so I here stumbled upon something that I can’t seem to wrap my head around. As a matter of fact this object is the last thing to be unglobalized
In the above code posted, previously if the modifier key is pressed, my “toggleYourLfo()” is invoked. My method residing in a separate Class component file is called “lfoTargetComponent.setLFOTargetStatus (id, module, mouseX, mouseY, appX, appY);”
The MySlider class I am using to declare rotary knobs, instead of normal Slider, in about 45 component classes (modules as in 8 of each; tone generator, envelope, effect, LFO, filter, plus a few more), components which are all created and used in PluginEditor.
Problem is my “lfoTargetComponent” which actually also handles envelope destinations so it should be renamed, anyways it needs to access a bunch of shared synth parameters (envelope and LFO). They were all global before, but have now been separated into classes, and I pass a reference of the needed object to “lfoTargetComponent” in PluginEditor’s constructor. All working great.
My problem arises when trying to change the “lfoTargetComponent” object from global, to well non-global.
Right now I have a large SynthParameters class. A public object of that is created in PluginProcessor which also need much of these parameters for effects. When voices are created in PluginProcessor, a reference is passed to SynthVoice. Also via the “processor” reference I can then also use it in PluginEditor, where as I wrote in the constructor first thing pass the reference to some effect components, and “lfoTargetComponent”.
So my question is where would I create an object of “LFOTargetComponent”? PluginProcessor or PluginEditor? But the for me hard question is how do I let MySlider know which object to invoke?
Hope my issue makes any sense.