Replacing Sample in Sampler
-
I am trying to replace a sample with another sample but I can't for the life of me get it working. I suspect it has something to do with asynchronous functions such as the clearSampleMap. Any ideas?
const var Sample1 = Content.getComponent("Sample1"); const var Sampler1 = Synth.getChildSynth("Sampler1"); Sample1.setMouseCallback(function(event) { if(event.clicked){ FileSystem.browse("undefined", false, "*.wav", function(result) { if(result){ Sampler1.asSampler().clearSampleMap(); var importedSamples = Sampler1.asSampler().importSamples([result.toString("FULLPATH")], false); importedSamples[0].set(2, 60); importedSamples[0].set(3,60); importedSamples[0].set(4,60); Sampler1.asSampler().saveCurrentSampleMap("Module1"); Sampler1.asSampler().loadSampleMap("Module1"); } }); } });
-
@VeryHuman
Maybe you should have a look at the custom sample import demo project from Christoph: