I have a backend script that has to import some 1600 (small) samples, set various sample attributes (root, velocity, RRgroup etc) then save the sampleMap but every time I run it it crashes HISE.
What are the best practices for batch importing like this? Tried:
- Background worker with
killAllVoicesAndCall
which made it worse
- Switching from HDD to SSD (lol)
- inline vs regular function, inline seems to be a bit more stable but still crashy
- using less (200) samples, still crashes just as often
samples = FileSystem.findFiles(samplesFolder, "*.wav", false);
for (i=0; i<samples.length; i++)
{
// Get sample name as string
prefix = "{PROJECT_FOLDER}" + samplesFolder.toString(1) + "/";
name = samples[i].toString(3);
path = prefix + name;
// Set the RR Group Amount & Import Samples
Sampler1.setAttribute(Sampler1.RRGroupAmount, NUM_ROUNDROBINS);
var importedSamples = Sampler1.asSampler().importSamples([path], false);
for (s in importedSamples)
{
sT = s.get(Sampler.FileName);
idx = sT.indexOf("root") + 4;
subString = sT.substring(idx, sT.length);
idxEnd = subString.indexOf("_");
subString = subString.substring(0, idxEnd);
rootNote = Math.round(subString);
//s.set(Sampler.LoKey, 64); // doesn't work
// Low Key Fix
for (x = 3; x < 5; x++)
{
s.set(x, lowKey);
}
s.set(Sampler.Root, rootNote);
s.set(Sampler.HiKey, highKey);
// etc
Sampler1.asSampler().saveCurrentSampleMap(sampleMapName);
}