User Specified Sample Folder per Sampler?
-
Hey Gang,
I've got a drum plugin that has 6 samplers with the ability to randomize samplemaps individually as well as globally. I have a customer request to allow users to select a custom folder/sampler, which has their own samples in it, and randomize through the samples of the selected folder instead of the samplemaps.
The plugin would have to default back to the samplemaps folder if none is selected or the custom folder is not found for whatever reason.
Is this possible? If so, does anybody have an idea where to start? Or even better, a snippet?
Best!
-
Yes it's possible. Use the sample import tutorial as a starting point - https://github.com/christophhart/hise_tutorial/tree/master/CustomSampleImport
-
@d-healey Hi David, I've seen this and used parts of it. I see within the SampleLoadSave.js how to import the custom samples.
I'm confused though how I allow a user to choose their own sample folder to be randomized.
I will be back at the studio tomorrow and can dig a bit deeper into into it.
Thanks and best!
-
@trillbilly said in User Specified Sample Folder per Sampler?:
@d-healey Hi David, I've seen this and used parts of it. I see within the SampleLoadSave.js how to import the custom samples.
I'm confused though how I allow a user to choose their own sample folder to be randomized.
I will be back at the studio tomorrow and can dig a bit deeper into into it.
Thanks and best!
FileSystem.browseForDirectory(var startFolder, var callback)
-
@Lindon said in User Specified Sample Folder per Sampler?:
FileSystem.browseForDirectory(var startFolder, var callback)
Yes, thank you. I have added this to the SampleLoadSave.js of the CustomSampleImport project. On Right Click, it opens the directory browser twice. I can select a folder but it does not load the samples in the folder or randomize the folder.
SampleDropper.setMouseCallback(function(event) { // Clear the sample on double click if(event.doubleClick) { Sampler1.clearSampleMap(); return; } this.data.hover = event.hover; // Show a directory browser on right click if(event.rightClick) { FileSystem.browseForDirectory(FileSystem.Samples, loadSample); return; this.repaint(); } });
Here is how I am randomizing some components in case I need something here. I know there is a way to reduce the script, I just don't know it.
const sampleMapsRAN = Sampler.getSampleMapList(); inline function onShuffleSamplebtn1Control(component, value) { if (value) { local index = Math.randInt(0, sampleMapsRAN.length); local sampleMap = sampleMapsRAN[index]; Sampler1.loadSampleMap(sampleMap); SampleViewer1.setValue(index); SampleName1.setValue(list[index]); } }; Content.getComponent("ShuffleSamplebtn1").setControlCallback(onShuffleSamplebtn1Control);
Thanks again.