Combobox List Alphabetically
-
-
@d-healey @Lindon When I add new samples to AudioFiles, they are also at the bottom of the list now, even after recompiling. Here is the new code with @d-healey advice and script. Can you see what Ive done wrong?
const var SlotSelectors = [Content.getComponent("SampleSelection1"), Content.getComponent("SampleSelection2"), Content.getComponent("SampleSelection3"), Content.getComponent("SampleSelection4")]; const var AudioLoopPlayers = [Synth.getAudioSampleProcessor("LoopPlayer1"), Synth.getAudioSampleProcessor("LoopPlayer2"), Synth.getAudioSampleProcessor("LoopPlayer3"), Synth.getAudioSampleProcessor("LoopPlayer4"),]; const var expHandler = Engine.createExpansionHandler(); const var expansionList = expHandler.getExpansionList(); const var allList = []; const var allIds = []; const var rootList = Engine.loadAudioFilesIntoPool(); allList.push("No Sample Loaded"); allIds.push(""); for(r in rootList) { allList.push(r.split("}")[1]); allIds.push(r); } var afl =[]; for(e in expansionList) { afl = e.getAudioFileList(); afl.sortNatural(); for(af in afl) { allList.push(af.split("}")[1]); allIds.push(af); } } for(s in SlotSelectors) s.set("items", allList.join("\n")); inline function onSlotSelectorControl(component, value) { local index = SlotSelectors.indexOf(component); if(value != 0) { AudioLoopPlayers[index].setFile(allIds[value-1]); } }; const var numbers = [64, 48]; const var ids = [-1, -1]; for(s in SlotSelectors) s.setControlCallback(onSlotSelectorControl);
-
@trillbilly Why are you using
sortNatural
instead ofsort
? -
@d-healey I was just trying to see if it made any difference. They both do the same thing in this case. Sorts all previous audiofiles but new audiofiles list at the bottom and out of order.
-
@trillbilly What happens if you sort root list instead? I haven't looked through your code so there might be something obvious but I don't have time at the moment
-
@d-healey Youree right, it is part of my issue, I sorted the
allList.sort
instead ofrootList.sort
. This fixed the issue for the most part. Now my issue is.- I have a repeating sample, and they are not even one above the other. It only repeats one time.
example:
GTR A
GTR B
GTR A
GTR C
GTR D
so on...- If I add a new sample that has a name that would go before my current first sample (GTR A) then that sample doesnt show. Its almost like it replaces that sample with itself?
-
@trillbilly You could just put a number at beginning of each one and then you get the order you want.
-
@d-healey I could, but doesnt look as good from the user end. I was hoping to name them GTR Name, PAD Name, SYN Name, etc so they are easy to view in the dropdown combobox.
I will keep plucking away for the time being. Just strange behavior is all.
-
@trillbilly You don't have to display the numbers to the end user ;) They're just used for sorting. Look up
substring()
-
@d-healey Of course they are lol. I will check it out. Thanks.