Samplemap Categories ?
-
You can filter strings using regex or
indexOf
. So just loop through all the sample map names and pick out the ones that have the text you're interested in.For example
for (i = 0; i < sampleMapNames; i++) { if (sampleMapNames[i].indexOf("kick") != -1) Console.print("This is a kick sample map); }
-
Thank you David, I shall tinker around with this.
-
Ok it has been awhile since I asked for help on this question and I appreciate the answer I received.
After bouncing around on projects for a few months I have gotten back to this position again and can't figure out how to implement this for loop and use it with the code for a combo box below.
My mind is not connecting the dots on this one (extreme n00b here), so Im asking for help again.
I went back to this thread where @d-healey created a code for me using a for loop method but I was uncertain how to apply the same technique for a combo box.
Thanks in advance for anyone who has time to help !
for (i = 0; i < sampleMapNames; i++) { if (sampleMapNames[i].indexOf("kick") != -1) Console.print("This is a kick sample map"); }
const var Sampler = Synth.getSampler("Sampler"); const var sampleMapList = Sampler.getSampleMapList(); ComboBox.set("items", sampleMapList.join("\n")); inline function onComboBoxControl(component, value) { Sampler.loadSampleMap(sampleMapList[value-1]); }; ComboBox.setControlCallback(onComboBoxControl);
-
@Dalart said in Samplemap Categories ?:
Ok it has been awhile since I asked for help on this question and I appreciate the answer I received.
After bouncing around on projects for a few months I have gotten back to this position again and can't figure out how to implement this for loop and use it with the code for a combo box below.
My mind is not connecting the dots on this one (extreme n00b here), so Im asking for help again.
I went back to this thread where @d-healey created a code for me using a for loop method but I was uncertain how to apply the same technique for a combo box.
Thanks in advance for anyone who has time to help !
for (i = 0; i < sampleMapNames; i++) { if (sampleMapNames[i].indexOf("kick") != -1) Console.print("This is a kick sample map"); }
const var Sampler = Synth.getSampler("Sampler"); const var sampleMapList = Sampler.getSampleMapList(); ComboBox.set("items", sampleMapList.join("\n")); inline function onComboBoxControl(component, value) { Sampler.loadSampleMap(sampleMapList[value-1]); }; ComboBox.setControlCallback(onComboBoxControl);
so just change this;
var myPreferedList = []; for (i = 0; i < sampleMapNames; i++) { if (sampleMapNames[i].indexOf("kick") != -1) myPreferedList.push(sampleMapNames[i]); //Console.print("This is a kick sample map"); }
to get an array of names and then put that in your combobox:
ComboBox.set("items", myPreferedList.join("\n"));
-
Im not sure I understand how:
var myPreferedList = [];
would get the contents of:
const var sampleMapList = Sampler.getSampleMapList();
-
@Dalart -- this was just a modification of your example of how to look through an array of names for the ones you want then put them into another array.
So can you work out how to apply this approach to SampleMapList?
-
@Lindon Havent had a chance to figure it out yet. Had a heart attack a week ago, will see if I can figure it out today.
-
-
Take it steady @Dalart.
Hope you're recovering mate! -
Thanks for the recovery wishes, It has been awhile and I seem to be recovering so far.
So I wandered back to this project and tried the solution above that Lindon helped me with but Im not getting any result in the ComboBox list can someone help find what Im doing wrong here ?
The code I used in my attempt is:
const var ComboBox1 = Content.getComponent("ComboBox1"); const var Sampler1 = Synth.getSampler("Sampler1"); const var sampleMapList1 = Sampler1.getSampleMapList(); var myPreferedList1 = sampleMapList1; for (i = 0; i < sampleMapNames; i++) { if (sampleMapNames[i].indexOf("Kick") != -1) myPreferedList1.push(sampleMapNames[i]); } ComboBox1.set("items", myPreferedList1.join("\n")); inline function onComboBox1Control(component, value) { Sampler1.loadSampleMap(myPreferedList1[value-1]); }; ComboBox1.setControlCallback(onComboBox1Control);
I am trying to limit which samplemaps are visible in each ComboBox I am using for each sampler.
None of my samplemaps are numbered as in Kick1, Kick 2, but are named like BasicKick, HeavyKick, etc. -
HiseSnippet 1502.3oc4XstaSbDEd23rTrgPAD+nUpUZjU+gsTvwFHPkPU3DmDTDDvJNPqTZDZxtismlcmY0LylhKBo9H0GAdj3Mn8Lyd2XbMtzRUqQJxmay7cNyYNeiouf6RjRtvxt5QSBIV1W1YvDlZbuwXJyZ+crruhyAXohHPwp1dRHVJIdV11UdnVgc0UsLed6C1F6iYtjbUVVOmScIOlFPU4Z628QTe+8vdjinAE79Nc22ky5w84Q.dp3z1JD6dFdD4IXsaq3XYegc8nJtXfBqHRK6U2l6MYvX9Oyh8+4TI8TehVni0.XghUuG22SiX82s5Ml560OMukVV1N8yqBUhqB2v4.pGMSed03pFCn7HJVOrWYdvqyRBO6Bva0X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