separating samplemaps per combobox
-
I created my samplemaps a certain way... example
(Rnb)Bell
(Trap)Bell
(Lofi)Bell
Etc...And I wanted each "engine" (3) to have its own list of sample maps...not all sample maps in each engine...
so, is it possible to separate the samplemaps?
-
@BWSounds This same thing came up a few months ago, a forum search might reveal it. But yes it's possible.
-
I believe that was me, im paying it forward. Here's the whole working namespace from my plugin. Everything works, just change the variables to your needs.
this should cover 1 combobox. Wash rinse and repeat.
namespace SampleMapComboBoxSwitcher { const var ComboBox1 = Content.getComponent("ComboBox1"); const var Back = Content.getComponent("Back"); const var Next = Content.getComponent("Next"); const var Kicks = Synth.getSampler("Sampler1"); const var SampleMapList = Kicks.getSampleMapList(); reg SampleMapFiltered = []; reg SampleMapIndexes = []; /// for (i = 0; i < SampleMapList.length; i++) { if (SampleMapList[i].contains("Kick_")) { SampleMapFiltered.push(SampleMapList[i].replace("Kick_", "")); SampleMapIndexes.push(i); } } //// if (SampleMapFiltered.length > 0) { ComboBox1.set("items", SampleMapFiltered.join("\n")); } else { ComboBox1.set("items", "where samplemap tho"); } inline function loadSampleMap(index) { if (index >= 0 && index < SampleMapFiltered.length) { local originalIndex = SampleMapIndexes[index]; Console.print("Loaded: " + SampleMapList[originalIndex]); Kicks.loadSampleMap(SampleMapList[originalIndex]); } } inline function updateSelection(newValue) { if (newValue > 0 && newValue <= SampleMapFiltered.length) { ComboBox1.setValue(newValue); loadSampleMap(newValue - 1); } } inline function onBackControl(component, value) { if (value == 1) { local newValue = ComboBox1.getValue() - 1; if (newValue < 1) newValue = SampleMapFiltered.length; updateSelection(newValue); } }; Back.setControlCallback(onBackControl); inline function onNextControl(component, value) { if (value == 1) { local newValue = ComboBox1.getValue() + 1; if (newValue > SampleMapFiltered.length) newValue = 1; updateSelection(newValue); } }; Next.setControlCallback(onNextControl); inline function onComboBox1Control(component, value) { updateSelection(value); }; ComboBox1.setControlCallback(onComboBox1Control); }; const var ComboBox1 = Content.getComponent("ComboBox1");
Important part:
//------------------------------------------------------you would replace here---- ///-------------------------------------------------------------------"(Rnb)"------- SampleMapFiltered.push(SampleMapList[i].replace("Kick_", ""));
-
@Chazrox hello mate can I get a snippet of this to better understand how to implement it in my projects thank you and sorry for the inconvenience
-
const var ComboBox1 = Content.getComponent("ComboBox1"); const var Back = Content.getComponent("Back"); const var Next = Content.getComponent("Next"); const var Kicks = Synth.getSampler("Sampler1");
You can do it. You just need these parts.
Create these components and name them as followsCOMPONENT/ NAME
Combobox / "ComboBox1"
Button / "Back"
Button / "Next"
Sampler / "Kicks"
Now drop the code into onInit and press F5.
You're going to have to know how to do what I just told you anyways so its best you learn it now. If you want to use this for multiple samplers you'll have to duplicate this process for the amount of different samplers you need.
-
@Chazrox
Thank you, will study this later tonight -
@BWSounds easy. Hit the thread back and let me know if you run into anything. I can try to help you more at that point. I recently did this for 12 samplers. Its not as much difficult as it is meticulous. I gave this to you in a namespace already, so you can highlight this whole namespace, move it to external script and do the same for each successive sampler. That way you can keep track of each script per button / per page.
- cheat code || gpty help
if you're concise enough with what you need changed, you can have gpt retype it for you and make sure all the variables are changed. Give it the whole namespace and ask it to revise it accordingly.
**Make sure you have all components already in the UI if you dont want a whole list of errors in the editor when you recompile. If you do get any errors, for instance "component not found"....just add that component to the UI and declare it as a const and recompile until no more errors.
-
@Chazrox
Coded all my samplers but having one issue with "loadSampleMap"
All of my combo boxes are categorize right but when I select a sample from any combobox it causes all the other combo boxes to change...I havent found the issue but in sure (I think) it might have something to do with "loadSampleMap"
-
@BWSounds make a test project with just two combo boxes and 3 sample maps. Play around and see if you can find the cause of the issue.
-
@BWSounds Did it work for the first sampler? What errors are you getting? What does your combobox script look like right now?
Sounds like something simple like a typo or missed revision on the duplicate scripts.
//Make sure 'ComboBox1' is the same on these lines.... //I miss these now and then and they'll cause weird things if not correct. inline function onComboBox1Control(component, value) //<----This one { updateSelection(value); }; ComboBox1.setControlCallback(onComboBox1Control); //<----This one TWICE }; // Check that each Combobox has correct component names in their callbacks. I would start there.
-
@d-healey Been doing that since 7 this morning lol, if I come on here its only because I've tried everything... But maybe is a typo or something simple I'm missing..
@Chazrox yes the first sample worked, but im thinking maybe it's a typo or small issue I'm just not seeing...I'll take a break and get back to it a little latter.. Thank you for your reply
-
@BWSounds all good. lmk.