How To Select Different Group of SampleMaps ?
-
@AHTV there are only one set of sample maps - those in the SampleMaps folder in your project.
The Combo boxes are just loading the required sample maps - you can have any number of sample maps referenced by your combo box - here you are using two in each box.
What is the callback you are executing for the second combo box? - post it here:
-
@Lindon said in How To Select Different Group of SampleMaps ?:
@AHTV there are only one set of sample maps - those in the SampleMaps folder in your project.
Thank for taking time to comment
Yes I know there's only 1 set of samplemaps but I would like each of dropdown box have it's own group of xml files (=each dropdown box have different xml set).I want to make a 2 group of dropdown, one Acoustic Piano Group and one Electric Piano Group. Each group consist of many sound, for example Ac Pno 1, Ac Pno 2, Ac Pno 3, Ac Pno 3 and user can layer it with the 2nd group of sound (Electric Piano) with many sounds too (Elec Pno 1, Elec Pno 2, Elec Pno 3 etc).
What is the callback you are executing for the second combo box? - post it here:
This is exaclty what I'm asking...What do I have to write on the callback so user can layer 2 group of sounds Ac Pno 2 & Elec Pno 5 for example, or Ac Pno 4 & Elec Pno 1. Right now, I don't have any code.
Thanks
-
have it's own group of xml files (=each dropdown box have different xml set).
A combo box just contains a list of what ever values you want to put in it. It doesn't contain xml files.
When you select a value in the combo box it will trigger a callback function (assuming you've assigned one to it).
In the callback you can get the value (one indexed) that was selected.
You can use that value as the index to an array that contains the references for your sample maps.
You could have two arrays if you wanted, one for each combo box, or you could just offset the index used in the second combo's callback.
If what I've said doesn't make sense you should start with 4 buttons instead of combo boxes so you can have a better understanding of the concepts.
-
@d-healey said in How To Select Different Group of SampleMaps ?:
have it's own group of xml files (=each dropdown box have different xml set).
A combo box just contains a list of what ever values you want to put in it. It doesn't contain xml files.
What I mean is in HISE example here : https://docs.hise.audio/tutorials/recipes/ui/general.html (under "Switch SampleMaps with a ComboBox"), we can switch to different SampleMaps by choose an entri in the dropdown box.
But, it list all the samplemaps that I have in the Samplemaps folder (Ac Pno & Elec Pno).
What I want is that dropdown box 1 only list some samplemaps (Ac Piano only) and dropdown box 2 have different samplemaps (Elec Pno only).Why I insist on using dropdown box, because of the desain of the GUI is more cleaner. If I have 30 preset/samplemaps, using 30 buttons is not so intuitif, but using Dropdown box, I only need 2 box (each have 15 presets).
Thanks
-
The problem is you are using that example without understanding it. You previously said you have no code, but that example contains code, so you need to learn what that code does to be in control of it.
Why I insist on using dropdown box
I'm recommending as a learning tool that you start simple, make a new project, put 4 buttons on the UI, and get a feel for how to create callbacks, and load sample maps. Then add a combo box and learn how to do it with a combo box, then go for two combo boxes, once you have it working in your test project you can try and implement it in your main project.
-
@d-healey Ok sorry I was wrong. The callback is present :
// Create a Script Reference for the Sampler Module const var s = Synth.getSampler("Sampler") // get the list off all SampleMaps that are saved in the SampleMaps project folder const var list = Sampler.getSampleMapList(); // Get the Combobox Widget and add all SampleMaps.xmls to the `items` list Content.getComponent("SampleMapSelector").set("items", list.join("\n")); inline function onSampleMapSelectorControl(component, value) { if (value) s.loadSampleMap(component.getItemText()); } Content.getComponent("SampleMapSelector").setControlCallback(onSampleMapSelectorControl);
The dropdown box list all of my samplemaps. How can I modify the code so I can have only some samplemap present in a dropbox box, not listing all samplemaps in the samplemaps folder?
Thanks
-
How can I modify the code so I can have only some samplemap present in a dropbox box, not listing all samplemaps in the samplemaps folder?
You'll need to loop through the list and use the string commands (like substring, indexOf, and contains) to split it up into two lists based on your parameters. Then you can use those two lists to populate your combo boxes.
Keep in mind that as soon as there are two combo boxes you are adding complexity because it is not simply a case of matching the value of one combo box to the xml references in an array. Which is what is happening in the example.
You have to do one of the things I mentioned before. Using the value to get a reference to the selected sample map. Either using two arrays or using one array and offsetting the index, I'd probably go for the second option.
-
@d-healey said in How To Select Different Group of SampleMaps ?:
How can I modify the code so I can have only some samplemap present in a dropbox box, not listing all samplemaps in the samplemaps folder?
You'll need to loop through the list and use the string commands (like substring, indexOf, and contains) to split it up into two lists based on your parameters. Then you can use those two lists to populate your combo boxes.
Keep in mind that as soon as there are two combo boxes you are adding complexity because it is not simply a case of matching the value of one combo box to the xml references in an array. Which is what is happening in the example.
You have to do one of the things I mentioned before. Using the value to get a reference to the selected sample map. Either using two arrays or using one array and offsetting the index, I'd probably go for the second option.
Ok thanks, I will try this, thanks a lot !
-
@AHTV Post some snippets of your progress when you need help
-
@d-healey said in How To Select Different Group of SampleMaps ?:
@AHTV Post some snippets of your progress when you need help
I will !
You are always been helpful, thanks !