Custom error messages
-
@DanH thanks! How do I perform a check to see if the samples are there or not?
-
@tomekslesicki I think it's the Locate one but try them all one by one and see what happens.
What do you want it to do by the way? Only display a message if the samples are missing?
-
@DanH yeah, that’s the point pretty much. I’m trying to customize it so that it’s easier for the users and more cohesive visually. So the idea is like this:
- hide the original missing samples popup
- check if the samples are there on init
- if they’re not, show a panel with some help text and a button to change the samples folder
So the only thing I need help with now is point 2 above :-)
-
@tomekslesicki Use the file system API, along with this function to check if the samples are installed.
-
@d-healey thanks! If it’s not too much of a hade, could you please give me an example of this call in practical context?
-
This will grab all the installed samples. If you want to check if any individual sample is missing you'll need to load in each sample map xml and search it for matches against the sample names.
const sampleFiles = Engine.getSampleFilesFromDirectory("", true); Console.print(sampleFiles.length);
-
@d-healey epic, thank you!
-
@tomekslesicki Something that might be simpler than reading each xml is if you just have a script file that contains an array with all the sample names. The only downside is if you add/change the samples in your project you'll also need to update this array.
Edit: Actually there doesn't appear to be a way to access the sample map xmls once the plugin is compiled (other than by loading them into a sampler) so this array idea might be the best choice.
-
I just remembered that Christoph added an error handler object to HISE script which can probably handle this, but last time I tried it it was buggy
-
https://docs.hise.audio/scripting/scripting-api/errorhandler/index.html
What's buggy there? I haven't used it for quite some time, but I'm not aware of any bugs in particular there.
-