Expansions + Preset Browser
-
@trillbilly have you not scripted anything for switching expansions? The preset browser won’t do anything but show the expansions presets.
-
-
@DanH Great, thank you. I wrongly assumed the preset browser fully connected to each expansion file since the Expansions column was now added.
I've got most of the code working with my project. Im able to get background image to switch and expansions to switch no problem, much appreciated!
-
I did run into an issue with samplemaps loading when I have multiple samplers. I have 4 samplers at the moment and the code compiles fine but the samplemaps do not populate my comboboxes. As a matter of fact, the samplemaps show in the expansion/samplemaps project folder but not in the sampler samplemaps dropdown when the corresponding expansion is chosen.
-
Also, although I can get my background to switch, I cant seem to get my knobs that are images to switch as well. I thought scripted them the same way as the "backgroundImage" but maybe I missed something. Ill go back and look into that more.
Can you spot where Im destroying my SampleSelection comboboxes?
//EXPANSION SETUP const var SampleSelection0 = Content.getComponent("SampleSelection0"); const var SampleSelection1 = Content.getComponent("SampleSelection1"); const var SampleSelection2 = Content.getComponent("SampleSelection2"); const var SampleSelection3 = Content.getComponent("SampleSelection3"); const var ExpansionSelector = Content.getComponent("ExpansionSelector"); const var expHandler = Engine.createExpansionHandler(); const var expansions = expHandler.getExpansionList(); expHandler.setAllowedExpansionTypes([expHandler.FileBased, expHandler.Intermediate, expHandler.Encrypted]); 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")); // 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); var sampleMaps = Sampler.getSampleMapList(); var sampleMapsed = Sampler.getSampleMapList(); const var Image1 = Content.getComponent("Image1"); var backgroundImage = ""; inline function newcombobox(newExpansion) { if(isDefined(newExpansion)) { local cx = expHandler.getCurrentExpansion(); sampleMaps = cx.getSampleMapList(); sampleMapsed = cx.getSampleMapList(); local expansionProps = cx.getProperties(); local expName = expansionProps.Name; for (i = 0; i < sampleMapsed.length; i++) { sampleMapsed[i] = sampleMapsed[i].replace("{EXP::"); sampleMapsed[i] = sampleMapsed[i].replace("}"); sampleMapsed[i] = sampleMapsed[i].replace(expName); } SampleSelection0.set("items", ""); SampleSelection0.set("items", sampleMapsed.join("\n")); SampleSelection1.set("items", ""); SampleSelection1.set("items", sampleMapsed.join("\n")); SampleSelection2.set("items", ""); SampleSelection2.set("items", sampleMapsed.join("\n")); SampleSelection3.set("items", ""); SampleSelection3.set("items", sampleMapsed.join("\n")); backgroundImage = newExpansion.getWildcardReference("background.png"); } else { sampleMaps = Sampler.getSampleMapList(); SampleSelection0.set("items", ""); SampleSelection0.set("items", sampleMaps.join("\n")); SampleSelection1.set("items", ""); SampleSelection1.set("items", sampleMaps.join("\n")); SampleSelection2.set("items", ""); SampleSelection2.set("items", sampleMaps.join("\n")); SampleSelection3.set("items", ""); SampleSelection3.set("items", sampleMaps.join("\n")); backgroundImage = "{PROJECT_FOLDER}halo_logo_200.png"; } Image1.set("fileName", backgroundImage); } expHandler.setExpansionCallback(newcombobox); newcombobox(undefined); const var Sampler0 = Synth.getChildSynth("Sampler0") const var Sampler1 = Synth.getChildSynth("Sampler1") const var Sampler2 = Synth.getChildSynth("Sampler2") const var Sampler3 = Synth.getChildSynth("Sampler3") inline function onSampleSelection0Control(component, value) { Sampler0.loadSampleMap(sampleMaps[value-1]); }; Content.getComponent("SampleSelection0").setControlCallback(onSampleSelection0Control); inline function onSampleSelection1Control(component, value) { Sampler1.loadSampleMap(sampleMaps[value-1]); }; Content.getComponent("SampleSelection1").setControlCallback(onSampleSelection1Control); inline function onSampleSelection2Control(component, value) { Sampler2.loadSampleMap(sampleMaps[value-1]); }; Content.getComponent("SampleSelection2").setControlCallback(onSampleSelection2Control); inline function onSampleSelection3Control(component, value) { Sampler3.loadSampleMap(sampleMaps[value-1]); }; Content.getComponent("SampleSelection3").setControlCallback(onSampleSelection3Control);
-
-
Also, strange behavior...
Now that Ive entered this code and removed my previous Samplemap + Combobox script, my Module Tree keeps greying out and forcing HISE to crash.
Has anyone ever experienced this?
-
@trillbilly the code from that thread is for switching expansions with a combobox rather than using the preset browser. The callback is for the combobox, and that callback populates the sampler comboboxes. I never tried it with the preset browser.
-
@DanH Yes, I changed to using a Combobox.
-
@trillbilly ok two things I can spot right now, firstly my sampler combobox callback looks like this:
inline function onSAMPLEBOX1Control(component, value) { Sampler1.asSampler().loadSampleMap(sampleMaps[value-1]); }; Content.getComponent("SAMPLEBOX1").setControlCallback(onSAMPLEBOX1Control);
and second the reference to your background image in the 'else' part of the Expansion combobox callback is wrong:
backgroundImage = "{PROJECT_FOLDER}halo_logo_200.png";
-
@DanH Ahhh, great eye. I pulled the comobox callback from my previous version trying to save time....tisk tisk.
Ok, so Ive changed both of these issues and get the same result.
Again, my samplemaps arent even showing in the sampler dropdown. It allowed me to create them but it will not show them or load them.
It seems all expansions are sharing a preset folder as well. All presets show for each expansion, even presets made from a different expansion.
-
@trillbilly Hmmmm, it's really hard to tell without seeing the whole project. Feel free to DM it over, I'll try to look this week if I find time.
-
@DanH No problem, Ill get it sent your way ASAP. Its super appreciated!