I’ve got my GUI interface to more or less the way I want it. It is all based on Flexbox, which I got started with via @daniel 's primer and Bruce Dawson has given me a lot of help as well.
This is just for my own purposes where the Flexbox design works beautifully. If I want to add a knob/button or change a group, it’s pretty easy and I don’t have to specifically re-lay anything out. So overall I really like the design.
But there is one major problem - it is brutally slow just to build or startup. Here for example is a very simple implementation in a “sandbox” kind of basic test/experiment synth (don’t expect it to sound good - it’s not intended to, it’s just for testing things):
This tiny version of the implementation with only 17 components and 4 groups takes 3.5 minutes to build on my i7 dual core laptop and 1.75 minutes to open as a standalone exe. While opening the standalone exe it is using ~50% CPU (likely one full core) and 2.1 GB RAM during these 1.75 minutes.
So there is obviously an insane amount of work it is doing trying to get this project loaded/running each time. In one of my actual synthesisers which I have now built, with somewhere between 60-100 knobs/buttons/etc, it now takes roughly over 10 minutes to build or open the synth. It has become insanely difficult to work with.
As noted in updates below, this only seems to be happening in Release Mode. In Debug mode, the GUI builds and runs quickly and easily.
In short, the way the system works is as follows:
- Parameters are declared in UsedParameters.h and then defined PluginProcessor.cpp.
- Functions which create groups of sliders/combo-boxes/buttons from these Parameters are defined in PluginEditor.h/cpp and the included file GUIElements.h.
- The individual components (sliders/combo/buttons) are created in GUIElements.h using the LabeledComponent class, while groups are created using the LabeledGroup class.
- Flexboxing is performed first in the LabeledGroup class where a FlexBox is placed around each individual component and group (knobBox & fb).
- Flexboxing is finished in “PluginEditor.cpp” where each LabeledGroup is added to groupsBox and lastly parentBox to arrange finally on the screen.
So two levels of Flexboxing are required - one to FlexBox the LabeledComponents within the LabeledGroups, and a second one to FlexBox the LabeledGroups on the screen.
It is definitely working, but at a massive computational cost every time it must be built or started up in Release Mode.
Is there any possible solution? Is there any obvious error that has been made or could be corrected?
I would greatly appreciate any help as this GUI method is otherwise in the big sense exactly as I would like it to be. But currently, if I had 10 of these synths loaded as VSTs I would dread to think how long that project might take to start, even on my desktop.