@d-healey Ahh ok I was trying this before.. let me give it another go.
I am using the demo snippet code for the buttons to swap samples.
const var ScriptFX1 = Synth.getAudioSampleProcessor("Script FX1");
const slot = ScriptFX1.getAudioFile(0);
// Load Audiofiles into pool ----------------------------------------------------------------------------------------------
Engine.loadAudioFilesIntoPool();
//--------------------------------------------------------------------------------------------------------
// const vars----------------------------------------------------------------------------------------------
//const var AudioLoopPlayer1 = Synth.getChildSynth("Audio Loop Player1");
const var Random = Content.getComponent("Random1");
const var KnS1 = Content.getComponent("KnS1");
const var Next = Content.getComponent("Next1");
const var Prev = Content.getComponent("Prev1");
//--------------------------------------------------------------------------------------------------------
// Array Samples in AudioFiles-Folder----------------------------------------------------------------------
const var inst = ["Wi_Kick-1.wav","Wi_Kick-2.wav","Wi_Kick-3.wav","Wi_Kick-4.wav","Wi_Kick-5.wav","Wi_Kick-6.wav"];
//--------------------------------------------------------------------------------------------------------
//Knob1 Sample selection---------------------------------------------------------------------------------
inline function onKnS1Control(component, value)
{
Synth.getAudioSampleProcessor("Script FX1").setFile("{PROJECT_FOLDER}"+inst[value]);
};
Content.getComponent("KnS1").setControlCallback(onKnS1Control);
//--------------------------------------------------------------------------------------------------------
// Random Button------------------------------------------------------------------------------------------
Random.setControlCallback(onRandom_Control);
inline function onRandom_Control(component, value)
{
if (value)
{
KnS1.setValue((Math.randInt(0, 5)));
KnS1.changed();
}
};
//--------------------------------------------------------------------------------------------------------
// Prev-Button----------------------------------------------------------------------------------------------
inline function onPrevControl(component, value)
{
if (value)
{
KnS1.getValue() > KnS1.get("min") ? KnS1.setValue(KnS1.getValue() - 1) : KnS1.setValue(KnS1.get("max"));
KnS1.changed();
}
};
Content.getComponent("Prev1").setControlCallback(onPrevControl);
//--------------------------------------------------------------------------------------------------------
// Next-Button ----------------------------------------------------------------------------------------------
inline function onNextControl(component, value)
{
if (value)
{
KnS1.getValue() < KnS1.get("max") ? KnS1.setValue(KnS1.getValue() + 1) : KnS1.setValue(KnS1.get("min"));
KnS1.changed();
}
};
Content.getComponent("Next1").setControlCallback(onNextControl);
//--------------------------------------------------------------------------------------------------------