Samplemap + Viewports
-
Im trying to load my samplemaps via a viewport, check.
The problem, all viewports (4 total = 1 for each sampler), load samplemaps for the same sampler (Sampler3). They flciker like they are changing in the correct Sampler, but they stay the same and change in Sampler3 instead.
Can somebody spot what Im doing wrong with this script?
//SAMPLERMAP SELECTION const var Sampler0 = Synth.getSampler("Sampler0"); const var Sampler1 = Synth.getSampler("Sampler1"); const var Sampler2 = Synth.getSampler("Sampler2"); const var Sampler3 = Synth.getSampler("Sampler3"); const var list = Sampler.getSampleMapList(); const var SampleViewer0 = Content.getComponent("SampleViewer0"); const var SampleViewer1 = Content.getComponent("SampleViewer1"); const var SampleViewer2 = Content.getComponent("SampleViewer2"); const var SampleViewer3 = Content.getComponent("SampleViewer3"); SampleViewer0.set("useList", true); SampleViewer0.set("items", list.join("\n")); SampleViewer1.set("useList", true); SampleViewer1.set("items", list.join("\n")); SampleViewer2.set("useList", true); SampleViewer2.set("items", list.join("\n")); SampleViewer3.set("useList", true); SampleViewer3.set("items", list.join("\n")); inline function loadSampleFromViewport(component, value) { Sampler0.loadSampleMap(list[value]); } SampleViewer0.setControlCallback(loadSampleFromViewport); inline function loadSampleFromViewport(component, value) { Sampler1.loadSampleMap(list[value]); } SampleViewer1.setControlCallback(loadSampleFromViewport); inline function loadSampleFromViewport(component, value) { Sampler2.loadSampleMap(list[value]); } SampleViewer2.setControlCallback(loadSampleFromViewport); inline function loadSampleFromViewport(component, value) { Sampler3.loadSampleMap(list[value]); } SampleViewer3.setControlCallback(loadSampleFromViewport);
-
@trillbilly
Create custom callback definitioninline function onSampleViewer0Control(component, value) { Sampler0.loadSampleMap(list[value]); }; Content.getComponent("SampleViewer0").setControlCallback(onSampleViewer0Control); inline function onSampleViewer1Control(component, value) { Sampler1.loadSampleMap(list[value]); }; Content.getComponent("SampleViewer1").setControlCallback(onSampleViewer1Control); inline function onSampleViewer2Control(component, value) { Sampler2.loadSampleMap(list[value]); }; Content.getComponent("SampleViewer2").setControlCallback(onSampleViewer2Control); inline function onSampleViewer3Control(component, value) { Sampler3.loadSampleMap(list[value]); }; Content.getComponent("SampleViewer3").setControlCallback(onSampleViewer3Control);
This will work.
-
@trillbilly just a quick look, you get the sample map list from a sampler named "Sampler", do you have that sampler?
const var list = Sampler.getSampleMapList();
-
@DabDab You're right, thank you.