Expansions / Combo Box + SampleMaps
-
@d-healey Ok, found a couple of contenders. Out of curiosity though, you mentioned in your expansions video that Christoph helped you implement a function whereby the Preset Browser would update itself when switching between expansions (23:20). This is kind of the reverse!
Also the instrument you showed as an example in the video used buttons to switch between expansions. Did you go in favour of the Preset Browser Expansion Column route in the end?
-
Did you go in favour of the Preset Browser Expansion Column route in the end?
Yes, I don't think that existed when I made the video.
-
@d-healey ok thanks.
So I'm looking in PresetBrowser.cpp line 616 and 691 as places of interest...
I've just realised that if I don't have the Expansion Column enabled in the Preset Browser then the presets won't switch at all when selecting expansions with the combo box (but I can set the column width to zero so I don't have to see it)
-
@d-healey Are either of these sections of use to me do you think?
-
@DanH oh I thought you'd solved it by hiding the columns. I'll take a look when I'm back at my computer.
-
You might just need a wrapper around this function - void PresetBrowser::rebuildAllPresets() - you might also need to include the set root file thingy but I don't know.
-
@d-healey ok thanks :) I'll come back to that in a sec.
I'm currently trying to get my combobox (SAMPLEBOX) to update with the samplemaps available in either an expansion or Factory mode. It's not really working however! I've tried to bend one of @Christoph-Hart's expansions examples to this purpose.
Any insight would be hugely welcome :)
const var expHandler = Engine.createExpansionHandler(); const var expansions = expHandler.getExpansionList(); const var expansionNames = []; expansionNames.push("FACTORY"); for(e in expHandler.getExpansionList()) expansionNames.push(e.getProperties().Name); const var ExpansionSelector = Content.getComponent("ExpansionSelector"); ExpansionSelector.set("items", expansionNames.join("\n")); inline function onExpansionSelectorControl(component, value) { //Engine.setCurrentExpansion(component.getItemText()); expHandler.setCurrentExpansion(component.getItemText()); }; Content.getComponent("ExpansionSelector").setControlCallback(onExpansionSelectorControl); // Implement the expansion switch inline function onExpansionSelectorControl(component, value) { local expansionToLoad = component.getItemText(); // We want the first item to reset the current expansion // so we need to change it to an empty string if(expansionToLoad == expansionNames[0]) expansionToLoad = ""; expHandler.setCurrentExpansion(expansionToLoad); }; Content.getComponent("ExpansionSelector").setControlCallback(onExpansionSelectorControl); inline function newcombobox(newExpansion) { if(isDefined(newExpansion)) { local cx = expHandler.getCurrentExpansion(); local xs = cx.getSampleMapList(); SAMPLEBOX.set("items", xs.join("\n")); } else { SAMPLEBOX.set("items", mySampleMapNames.join("\n")); } } expHandler.setExpansionCallback(newcombobox); // Call it once with undefined so that it loads the root images newcombobox(undefined);
-
You have to clear the items before you can replace them - not sure why, just a HISE quirk.
HiseSnippet 958.3ocuVs0aaaCElxwJaRqqnEX+.H7Sx.pARJWZGJFlqcRJLZcpQcWw.VK5Xnni4hDogDUVMFBv9oteB8k875gRxVxYJYIdXSuct+cN7bQiSjTVZpLAYX8lEyYHi6YNYgPMavLBWfFdHx39liHoJVBtfU+EyIoorPjgwVOWyvvpMJ+6SeeeRDQPYUrPn2J4T1K4wbUE2w8dAOJ5XRH6M73ZZuWugToXfLRlA3YKSOzbB8bxYrSHZ0ZYhL19nPtRlLQQTrTPm9xvESlI+UQg9ukmxOMhoI7QS.GUvFMXFOJb7xbMEgLZOtJy2pHy+FyQ7P9J9UUfGjK.WYQ8ZfQq0gT60fj+0AoikQgZGbMvynF7ZW.uGZNglvmqpjnw1WYNT.ONSIPYuNrJzE05OaYNPBZHT6DSNmcbBPrxBmC77bw66408o11PoOUgi3oJe72g+IeWbfKdWW7dfFu+o0DGnEefK9wt3m3h+VWrGH1lKh3BFdZlfp3RAVJ5moTRguN7IxHGpLdtT..wEeAIJi0092rs3SwNkTV.o0.Y7ox9xO5uSJS4zgqXwocbwc5.H7Zkli4c9EIW3z4chNc05dokk8k.rVl7mwTCVB.mNkPqSWsiJA3.RTzoP+lyUQd2aH6B9+I6BtZ18OlaA2btETK2JdYuf.S3KQ.7B2ryWogFx10JGmHUrWIbxSa6KswWUzzoMJqDFQrjFEq2OjbSF5HxhOkkTunqUDFZVepb6a2TIsHoqonTLTvUuZNqjtZt0ug4VTYUSOAWhPPUU976CJmeWVBQ7P836pJJJOEpu6D8CCOjnHKcF3WHVyYIJtNkLNjcArasX4fk4grzyUx4P3V8bgL9hhPe+xPW71mGXKyxlbzGWExe+Y8VTQ7hd7zQxXvOjDfsQKlf.kL8pvWxHIB8VlTxErghwILnUSSitSwNnVr+in5wdz+xXu8srjWEeDsV7+4o8hIfLSCSfJePTamucf8t16YuObB6usdFNRHCyhHp0ubnOQVJ.ZbWaEsdMrHkqVT+D5c3bhWimSZrs7VB2GZNlqnyZFusZ.uPq4+03s737WadzzoLppBrsMO9G2zKw2An7ZYlhKNaDQkv0sDmjEOA9+DJCPhPvhR0sIszi9EzdZZckYBSDlS7WvWoPeMsQoP+kBQwDZh7CzhEF5y+eYNG.Sh7+7wB9ELfFuZGgoo2NdnXXb3CTptT7H.6MaSvFXytafM6sA1r+FXyAafMOdCr4I2nM5MQOKSIiKFS.FiOJeWsgwQ4qpx6HQeFP3tGG.
-
@d-healey lovely, seems to work so far, thanks!
-
So below is the combox box callback for selecting a sample map. I was hoping that 'sampleMaps' would update when switching between expansions but it doesn't (I don't think).
The combox displays the available sample maps, however it continues to select the corresponding sample maps from the factory list. The sampler in Hise even has the expansion's sample maps in its menu, but obviously the callback is processing the original 'sampleMaps' list. So I guess I need to make 'sampleMaps' dynamic somehow...
Any clues welcome
const var sampleMaps = Sampler.getSampleMapList(); inline function onSAMPLEBOXControl(component, value) { Sampler1.asSampler().loadSampleMap(sampleMaps[value-1]); }; Content.getComponent("SAMPLEBOX").setControlCallback(onSAMPLEBOXControl);
-
@DanH said in Expansions / Combo Box + SampleMaps:
I was hoping that 'sampleMaps' would update when switching between expansions but it
It will if you use the previous example you posted
local cx = expHandler.getCurrentExpansion(); local xs = cx.getSampleMapList();
-
@d-healey I've done that (if that's what you mean). It feels like I need to push the list into 'sampleMaps' each time I switch expansion
-
I need to push the list into 'sampleMaps' each time I switch expansion
Instead of
local xs = cx...
you needsampleMaps = cx..
-
@d-healey hmmmm, getting the error:
Can't assign to this expression!
-
@DanH Need more info.
-
@d-healey What would help?
-
@DanH Seeing the error message :) What is the expression that can't be assigned?
-
-
@DanH sampleMaps is a const, you can't overwrite a const.
-
@d-healey doh