I believe that was me, im paying it forward. Here's the whole working namespace from my plugin. Everything works, just change the variables to your needs.
this should cover 1 combobox. Wash rinse and repeat.
namespace SampleMapComboBoxSwitcher
{
const var ComboBox1 = Content.getComponent("ComboBox1");
const var Back = Content.getComponent("Back");
const var Next = Content.getComponent("Next");
const var Kicks = Synth.getSampler("Sampler1");
const var SampleMapList = Kicks.getSampleMapList();
reg SampleMapFiltered = [];
reg SampleMapIndexes = [];
///
for (i = 0; i < SampleMapList.length; i++)
{
if (SampleMapList[i].contains("Kick_"))
{
SampleMapFiltered.push(SampleMapList[i].replace("Kick_", ""));
SampleMapIndexes.push(i);
}
}
////
if (SampleMapFiltered.length > 0)
{
ComboBox1.set("items", SampleMapFiltered.join("\n"));
}
else
{
ComboBox1.set("items", "where samplemap tho");
}
inline function loadSampleMap(index)
{
if (index >= 0 && index < SampleMapFiltered.length)
{
local originalIndex = SampleMapIndexes[index];
Console.print("Loaded: " + SampleMapList[originalIndex]);
Kicks.loadSampleMap(SampleMapList[originalIndex]);
}
}
inline function updateSelection(newValue)
{
if (newValue > 0 && newValue <= SampleMapFiltered.length)
{
ComboBox1.setValue(newValue);
loadSampleMap(newValue - 1);
}
}
inline function onBackControl(component, value)
{
if (value == 1)
{
local newValue = ComboBox1.getValue() - 1;
if (newValue < 1) newValue = SampleMapFiltered.length;
updateSelection(newValue);
}
};
Back.setControlCallback(onBackControl);
inline function onNextControl(component, value)
{
if (value == 1)
{
local newValue = ComboBox1.getValue() + 1;
if (newValue > SampleMapFiltered.length) newValue = 1;
updateSelection(newValue);
}
};
Next.setControlCallback(onNextControl);
inline function onComboBox1Control(component, value)
{
updateSelection(value);
};
ComboBox1.setControlCallback(onComboBox1Control);
};
const var ComboBox1 = Content.getComponent("ComboBox1");
Important part:
//------------------------------------------------------you would replace here----
///-------------------------------------------------------------------"(Rnb)"-------
SampleMapFiltered.push(SampleMapList[i].replace("Kick_", ""));