multi-column comboboxes -> HISE crashes constantly
-
and why not do the replace once(on the sampleMapList) and then update all 4 with "items"
const var sampleMaps = Sampler.getSampleMapList(); for (map in sampleMaps) { if(map.contains("Bass_")) map.replace("Bass_", "Bass::"); if(map.contains("Bell_")) map.replace("Bell_","Bell::"); if(map.contains("Brass_")) map.replace("Brass_","Brass::"); if(map.contains("Drum_")) map.replace("Drum_","Drum::" ); if(map.contains("FX_")) map.replace("FX_","FX::"); if(map.contains("Git_")) map.replace("Git_","Git::"); if(map.contains("Keys_")) map.replace("Keys_","Keys::"); if(map.contains("Lead_")) map.replace("Lead_","Lead::"); if(map.contains("Pad_")) map.replace("Pad_","Pad::"); if(map.contains("Plug_")) map.replace("Plug_","Plug::" ); if(map.contains("Seq_")) map..replace("Seq_","Seq::"); if(map.contains("String_")) map.replace("String_","String::" ); if(map.contains("Voice_")) map.replace("Voice_","Voice::"); } } Console.print(trace(sampleMaps)); const var sampleCombos = [Content.getComponent("cmbSamples1"), Content.getComponent("cmbSamples2"), Content.getComponent("cmbSamples3"), Content.getComponent("cmbSamples4")]; for(c in sampleCombos) { c.set("items", sampleMaps); }
-
-
@Oli-Ullmann look at what you are getting back in the array sampleMaps after you've done the substitution, you are actually probably better off doing
if(map.indexOf("Bass_") == 0)
rather than
if(map.contains("Bass_"))
to make sure you are replacing one only occurrence
Dave's approach is even better...
-
@Lindon Thank you!
-
@Oli-Ullmann this is interesting:
const var sampleMaps = ["Bass_ONE","Bass_Two","Bass_three"]; const cmbSamples = Content.getAllComponents("ComboBox"); for (map in sampleMaps) { reg firstSegment = map.substring(0, map.indexOf("_") + 1); reg secondSegment = map.substring(map.indexOf("_") + 1, map.length); Console.print(firstSegment.indexOf("_")); firstSegment.replace("_", "::"); Console.print(firstSegment); Console.print(secondSegment); }
replace isnt working....for me at least..
-
@Lindon Ok here you go.. the best of Dave and me ...
const var sampleMaps = ["Bass_ONE","Bass_Two","Bass_three","Gtr_One"]; const cmbSamples = Content.getAllComponents("ComboBox"); for (map in sampleMaps) { reg firstSegment = map.substring(0, map.indexOf("_") + 1); reg secondSegment = map.substring(map.indexOf("_") + 1, map.length); firstSegment = firstSegment.replace("_", "::"); map = firstSegment + secondSegment; } Console.print(trace(sampleMaps)); populateComboBoxes(); inline function populateComboBoxes() { for(c in cmbSamples) { c.set("items", sampleMaps.join("\n")); } }
-
@Lindon Thank you very much! I'll try that out right away! :-)
-
@Lindon Wrap it in a function to avoid wasting reg variables.
-
@d-healey yes yes ....I know...Im lazy.
-
@Lindon so here is it all wrapped in one function call
const var sampleMaps = ["Bass_ONE","Bass_Two","Bass_three","Gtr_One"]; const cmbSamples = Content.getAllComponents("ComboBox"); populateComboBoxes(); inline function populateComboBoxes() { for (map in sampleMaps) { local firstSegment = map.substring(0, map.indexOf("_") + 1); local secondSegment = map.substring(map.indexOf("_") + 1, map.length); firstSegment = firstSegment.replace("_", "::"); map = firstSegment + secondSegment; } for(c in cmbSamples) { c.set("items", sampleMaps.join("\n")); } }
-