setFile + index/multiple slots?
-
I have a scriptnode network with 2 convolutions, I've setup the external data slots but how do I programmatically access the second one?
Engine.loadAudioFilesIntoPool(); const pnlCabALoader = Content.getComponent("pnlCabALoader"); const fxSlots = [Synth.getSlotFX("modularA"), Synth.getSlotFX("modularB"), Synth.getSlotFX("modularC"), Synth.getSlotFX("modularD"), Synth.getSlotFX("modularE"), Synth.getSlotFX("modularF"), Synth.getSlotFX("modularG")]; // Drop inline function pnlCabALoaderDrop(f) { if(f.drop) { local file = FileSystem.fromAbsolutePath(f.fileName); switch (this) { case pnlCabALoader: for (slot in fxSlots) { local effectId = slot.getCurrentEffectId(); if (effectId == "cab") { local id = slot.getCurrentEffect().getId(); local ref = Synth.getAudioSampleProcessor(id); ref.setFile(f.fileName); // sets the first slot, but how to set the second one? } } break; case pnlCabBLoader: // second file slot logic would go here break; } this.set("text", file.toString(3)); this.repaint(); } } pnlCabALoader.setFileDropCallback("All Callbacks", "*.wav", pnlCabALoaderDrop);
-
@iamlamprey use
getAudioFile(slotIndex)
. This returns a new object with more or less the same methods but represents one of the slots.const var asp = Synth.getAudioSampleProcessor("Script FX1"); const var slot1 = asp.getAudioFile(0); const var slot2 = asp.getAudioFile(1); slot1.loadFile("your file goes here.wav"); slot2.loadFile("your other file goes here.wav");
-
@Christoph-Hart Perfect, thank you!
-
I iamlamprey marked this topic as a question
-
I iamlamprey has marked this topic as solved