Change Sample Map via ComboBox
-
@pgaudioworks
getSampleMapList()
is a function of the Sampler class, notchildSynth
Try using
Synth.getSampler("Sampler1");
-
@d-healey I updated it and I'm still getting the same error.
const var Sampler1 = Synth.getSampler("Sampler1"); Console.Print(Sampler1.getSampleMapList());
Error:
Interface:! Line 5, column 14: Function / constant not found: Console.Print {SW50ZXJmYWNlfG9uSW5pdCgpfDEwNHw1fDE0} Master Chain:! Line 5, column 14: Function / constant not found: Console.Print {SW50ZXJmYWNlfG9uSW5pdCgpfDEwNHw1fDE0}
-
@pgaudioworks The error message is telling you it can't find the function you are calling on line 5. You are calling two functions on that line, try eliminating one of them and see if the error remains.
I just noticed, the error message tells you which function.
-
@d-healey really grateful for your help. I think I'm confused that I'm calling two functions. How does the console know what to print if I don't include both Console.Print and getSampleMapList?
-
@pgaudioworks Console.Print is not a function ;)
-
@d-healey I shouldn't have had the p capitalized, got it. I've now gotten this far:
const var Sampler1 = Synth.getSampler("Sampler1"); const var SampleSelection = Content.getComponent("SampleSelection"); Console.print(Sampler1.getSampleMapList()); Console.print(SampleSelection.getValue()-1); inline function onSampleSelectionControl(component, value) { Sampler1.loadSampleMap(SampleSelection.getValue()-1); }; Content.getComponent("SampleSelection").setControlCallback(onSampleSelectionControl);
The console is returning the right values, but the sampler isn't changing when I update the combo box. Am I any closer?
-
@pgaudioworks Is SampleSelection.getValue()-1 the name of your sample map?
-
@d-healey it's the name of the combo box.
-
Sampler1.loadSampleMap(SampleSelection.getValue()-1);
loadSampleMap expects the name of a sample map.
-
@pgaudioworks try someting like this, where "cmbSampleMap" is my Combo Box
// My Sample Map on Combobox const var sampleMaps = Sampler.getSampleMapList(); // get a Sample Map List const var cmbSampleMap = Content.getComponent("cmbSampleMap"); //combo box const var Sampler1 = Synth.getChildSynth("Sampler1"); // Sampler Reference // populate combo box with sample maps cmbSampleMap.set("items", sampleMaps.join("\n")); inline function oncmbSampleMapControl(component, value) { //Console.print(value); Sampler1.asSampler().loadSampleMap(sampleMaps[value-1]); }; Content.getComponent("cmbSampleMap").setControlCallback(oncmbSampleMapControl);