Yet another layout system for JUCE


#1

Hi !

I have been working recently on a small project to wrap up the “ff_layout” module written by Daniel Walz: ffLayouts, and provide a simple description of audio plugins GUIs. As an example, the following interface:
Pl-Ex-01
can be described with these lines:

static constexpr int sliderCount {3};  // we use 3 sliders
static constexpr int tbuttonsCount {0}; // no text buttons
static constexpr int tgbuttonsCount {0};  // no toggle buttons
static constexpr int comboBoxCount {0};  // no combo box
static constexpr int labelCount {4};
...
enum cmptsIdts {
    // sliders
    sl1=sliderFirst, sl2, sl3,
    // labels
    lab0=labelFirst, lab1, lab2, lab3
};
...
        allStrs = * new std::vector<struct AppStringsDesc> {
            { none, "Error 80", "error" },
            { lab0, "A very simple plugin" },
            { lab1, "Gain"},
            { lab2, "Pan"},
            { lab3, "Volume" }
        };
        allVals = * new std::vector<struct AppValuesDesc> {
            { sl1, {0.0f, 2.0f, 0.01f}, 1.0f },
            { sl2, {-1.0f, 1.0f, 0.01f}, 0.0f },
            { sl3, {0.0f, 100.0f, 0.001f, 0.25f}, 0.0f},
        };
        codeLout = * new std::vector<int> {
            startCmpt(pluginEditorWindow),
                aCol(),
                    aRow(),
                        aLabel(lab0), pad(bottom, 15), colorize(c_orange,c_transparentBlack),
                    endRow(), setStretch(1.0, 0.35),
                    aRow(),
                        aSlider(sl1,rotVD), withLabel(lab1),
                        aSlider(sl2,rotVD), withLabel(lab2),
                        aSlider(sl3,rotVD), withLabel(lab3),
                    endRow(),
                endCol(),
            endCmpt(pluginEditorWindow)
        };

So the approach is essentially declarative, with no additionnal programming involved. This also takes care of declaring the parameters (using APVTS) and saving or loading presets. So the only thing to add is the DSP work.

As an other example, the description of the layout for this (rather ugly) GUI is about 80 lines:
Pl-Ex-02

If you want to have a look at it, the very first version is on: LayoutBuilder, with these two examples and some documentation.

Caveat: this is my very first JUCE project, in a WIP state - and I’m not a C++ expert. This has only been tested on Mac OS X 10.11.6, with Xcode 8.2.1, and checked with REAPER. Note also that this works with the current (Master) version of JUCE, and that it uses “createAndAddParameter” which I understand will be sooner or later deprecated.

Have fun (if possible)…