Evening everyone hope you are all well. So code incoming, I've got a dropdown box to change loaded sample maps - they've got quite a varying range depending on the selected map and was colour coding the keys for the user so its clear what you've got to work with.
The issue is that it seems a bit inaccurate and to be honest I'm not sure why some are very close 1 or 2 notes missed low and high others are missing 16-20 notes left uncoloured completely, as always I suspect there is something I've missed!
/// Dropdown Sample Maps
Content.getComponent("cmbsamplemap").setControlCallback(oncmbsamplemapControl);
const var sampleMaps = Sampler.getSampleMapList();
const var cmbsamplemap = Content.getComponent("cmbsamplemap");
cmbsamplemap.set("items", sampleMaps.join("\n"));
inline function oncmbsamplemapControl(component, value)
{
Sampler1.asSampler().loadSampleMap(sampleMaps[value-1]);
for (i = 0; i < 127; i++)
if (Sampler1.asSampler().isNoteNumberMapped(i))
Engine.setKeyColour(i, Colours.withAlpha(Colours.green, 0.3));
else
Engine.setKeyColour(i, Colours.withAlpha(Colours.white, 0.0));
};```