setFrontendMacros
-
@Christoph-Hart - So originally I had 5 macros set up using .setFrontendMacros and everything worked fine - if you right-click a slider / button then the pop menu appears with all 5 Macro options.
Engine.setFrontendMacros(["LFO1", "LFO2", "STEP", "X", "Y"]);
In an update I added a 6th Macro. This was all working fine in HISE (or so I thought). When I open the project in HISE the new Macro doesn't appear in the pop up menu - however if you select the 4th position (X) in which I put the new Macro in (in-between STEP and X) it links to the new Macro. So it works but it doesn't appear in the list. If I then hit compile the new ENV Macro will finally appear in the menu (and work as intended).
Engine.setFrontendMacros(["LFO1", "LFO2", "STEP", "ENV", "X", "Y"]);
I did a bit more digging and it seems that it's linked to the preset which is selected. The old presets will only present the old pop menu list (the presets themselves do not contain any save data for the new ENV Macro).
New presets created after compilation and with ENV appearing in the list will preset the new Pop Up Menu...! (These DO have save data for the new Macro).
I'd rather not have to try and add in the new Macro into every old preset's save data (there's 100s of them and user's have the option to overwrite presets so this could be a breaking change for many of them).
Is this a bug or intended behaviour?!
Many Thanks! :)
-
@Christoph-Hart friendly bump! Any ideas how I can overcome this?
-
@Christoph-Hart Am I doing something silly or...? Have made a simple project here which includes the presets (or can test with snippet below).
HiseSnippet 1136.3ocsV0raaaDDdoroasRZSSQd.H7IG.AGI2fdn8PrkrjgPrrELUbcfQPvZxkRKL4tD6tz1xF4Vd.5SRA5SPeUZeC5sBzKtyPRIRYq5XEfvCjb9c+lcmclouR5wzZohXs5fwwLh0iscGKLiZMhxEjt6fL5scqCOXPa2AMHMGGS0ZlOwxZocQMrVcYR5ye+plzPpviUvhPNRx8X6wi3lBt82507vvNTe1.dTIse4Vc8jhVxPYBflkrqShodmQGx1mhpUwlXsRaetQpbMTCSC5zT5O1cj7BQl9Gw07SCYHQChK3nL1jVi3g98mDoZBwZ49Ew8RYw8yr6w84S4WD+eWp.mBKJuGXU49fTiE.RVkfzxYP5o1tdJdroPBhmGY2UXXp.JrUWFJY5RprqkcKIngvrQD8LVGEPL0h0+w50q4.ud9OWs5KdQawPtfsglYRUiI76Q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ig in the source code but it's not obvious how the macro right-click pop menu populates itself... any pointers?
-
Take a look at the .preset file. At the end of the xml you'll see the macro name data, this will be used to restore the names. If there is a mismatch between the item names and what you're calling with setFrontendMacros(), then it's undefined behaviour and I haven't considered this case, but it shouldn't be too hard to solve it.
There are multiple ways to solve this, the most easiest one would be to call
setFrontendMacros()
in a post preset load callback when you load an older preset.Take a look at
MacroControlledObject::enableMidiLearnWithPopup()
in hi_core/hi_core/MacroControlledComponents.cpp`, that's where it populates the menu:auto name = macroChain->getMacroControlData(i)->getMacroName(); if (name.isNotEmpty()) { mToUse->addItem((int)AddMacroControlOffset + i, "Connect to " + name); }
so if the macro name is empty (which it will be after the preset load overwrote the macro names), it won't show up.
-
@Christoph-Hart thank you - didn't think of that! I guess I could just call setFrontendMacros() when I load every preset to be certain...
Great, cheers :)
-
-
@Christoph-Hart Yes just made that mistake