RS-MET icon indicating copy to clipboard operation
RS-MET copied to clipboard

How do I add modules during runtime?

Open elanhickler opened this issue 8 years ago • 1 comments

I need to add modules similar to chainer, like LFOs, ADSRs, etc. I want to have a + button to add a new modulator in a section of the GUI where my LFOs currently are in Mushroom Generator.

elanhickler avatar Dec 02 '17 19:12 elanhickler

actually, you do that the very same way as on construction time. just create the new module with new and add it via the function AudioModule::addChildAudioModule to the parent module. remove it via removeChildAudioModule. you will also need to add the child-editor using addChildEditor (it's in the editor baseclass of AudioModuleEditor).

you may also look at AudioModuleChain::addModule, although, it's a bit unnecessarily complicated for your use case as i'm using factory methods there to create a module instead just the plain new operator

RobinSchmidt avatar Dec 04 '17 15:12 RobinSchmidt