Hi all!
I need help!! I can't manage to get the categories working. theres something I'm not doing right..Could someone please have a look over this code and see where its going wrong?
problem 1.
The sampleMaps List is not taking effect of the categorisation.
It should for "BD_Ludwig_Jazz1.xml" take "BD_" and put it inside its own "drm_category" and "Ludwig" in its own "drm_sampleName" and display only sampleMap:"Jazz1" but its not working...
What am I missing?
@ustk ? @Christoph-Hart ?
problem 2. The categories them selves (CAT1, CAT2) are not displaying correct.
I can only ever see 1 items in the CAT1, CAT2 viewports.
Why could this be?
Pardon my Javascript skills,
Thanks!
// =================== [ Samplemap List ] ================== //
const var SamplemapList = Content.getComponent("SamplemapList");
const var SamplemapList_CAT1 = Content.getComponent("SamplemapList_CAT1");
const var SamplemapList_CAT2 = Content.getComponent("SamplemapList_CAT2");
// Allow the viewport to list the items
SamplemapList.set("useList", true);
SamplemapList_CAT1.set("useList", true);
SamplemapList_CAT2.set("useList", true);
const var Sampler = Synth.getSampler("Sampler");
const var sampleMapList = Sampler.getSampleMapList();
// Populate the formatted list in a new array
const var formattedSamplemaps = [];
// Remove string from sampleMap name
const var charsToRemove = ["BD_", "HH_", "SD_"];
for (i = 0; i < sampleMapList.length; i++)
{
var newName = sampleMapList[i];
for (j = 0; j < charsToRemove.length; j++)
{
newName = newName.replace(charsToRemove[j], "");
}
formattedSamplemaps.push(newName);
}
// put under category
const var names = ["BD_Ludwig", "BD_Xyz1", "SD_TamaSLP", "SD_Ludwig"];
for (i = 0; i < sampleMapList.length; i++)
{
var newCatSplit = sampleMapList[i];
for (j = 0; j < names.length; j++)
{
// this will hold the samplenames sorted by category
var obj = {};
for(n in names)
{
// This splits the string into a list using the given separator
var sp = n.split("_");
var drm_category = sp[0];
var drm_sampleName = sp[1];
// We can check if the category is already used
if(isDefined(obj[drm_category]))
obj[drm_category].push(drm_sampleName); // append to the existing list
else
obj[drm_category] = [drm_sampleName]; // create a new list at the key
newCatSplit = newCatSplit.replace(names[j], "");
}
formattedSamplemaps.push(newCatSplit);
}
//sampleMapList[i].set("visible", false);
}
// Update the viewport
SamplemapList.set("items", formattedSamplemaps.join("\n"));
// Load sampleMap
inline function onSamplemapListControl(component, value)
{
Sampler.loadSampleMap(sampleMapList[value]);
};
Content.getComponent("SamplemapList").setControlCallback(onSamplemapListControl);
// =================== [ /Samplemap List ] ================== //
// ============== [ Samplemap List Categories ] ================== //
// Drum Type; BD, SD, HH, etc
inline function onSamplemapList_CAT1Control(component, value)
{
SamplemapList_CAT1.set("items", [drm_category].join("\n"));
SamplemapList_CAT2.set("items", [drm_sampleName].join("\n"));
};
Content.getComponent("SamplemapList_CAT1").setControlCallback(onSamplemapList_CAT1Control);
// Drum sub-Type;
// BD: Ludwig, Xyz1, // SD: TamaSLP, Xyz, // HH: Xyz123, etc;
inline function onSamplemapList_CAT2Control(component, value)
{ //.set("visible", false);
//SamplemapList_CAT2.set("items", sp.join("\n"));
//SamplemapList.set("items", sp.join("\n"));
};
Content.getComponent("SamplemapList_CAT2").setControlCallback(onSamplemapList_CAT2Control);
// ============== [ /Samplemap List Categories ] ==================
HiseSnippet 3469.3oc6arsbaabEPxvIj0L2ZdnuzY1poyTpIJRjTVJI1Moz5hCcpjsFQEmLiphlkDKIgMHVTbQRzY7L4SoeB8o9b9R52P+CZO6MfEf2fjsbcaDch.2ama6YO2VvCBncIggz.CyRGMxmXXdGq1i7hFr8.rimwi1wvrrUm.54gjfML1ZjONLjXaXZt3WyF2rzsL3e9W+osvtXutjztLLdJ0oKYOmgNQo8dPy+riq6Cw1jibFpM6617QcodaScow.srnUMCeb2mi6SdLlMsErLLu8t1NQzf1Q3HRng4s1hZOp8.54dh4+TmPmNtDVi5FsA.I59gTWaFEy50X6ANt1Gn34PCCSqCRk.KJj.er09N1NI8mJI9.9.nzUnKOLWXVjWccxqVwIOSMx6VBx6CsZ2MvwOJcDFs8qrdjWDInGF1BzIKwbMV3eVwZaJLCunUGheN4gAPijUTcyZ0VAsQsZKe+JkqTds0Pe43ePGiZiG56RFh8Q64DFgNYBSCs1ZUJC6jvvmgCRW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