HISE icon indicating copy to clipboard operation
HISE copied to clipboard

Dynamically download samples on iOS

Open bthj opened this issue 2 years ago • 1 comments

Downloading samples into the FileSystem.Samples directory doesn't work on an iOS device (though it works on a simulator), where the Samples folder seems to be part of the read-only app bundle. A couple of changes solve this particular issue, which can be seen in the commit here: https://github.com/bthj/HISE/commit/adc38aeb530ed466e9c174bfff40e33e2dc7b8f0

A code snippet with relevant HISE Script functionality can be seen here: https://forum.hise.audio/topic/5423/dynamically-load-instruments-over-the-internet/8?_=1646490547650

Should I submit a Pull Request with this change?

bthj avatar Mar 05 '22 14:03 bthj

I would suggest a more clean fix than what you did in the commit and try to fix the problem at the root.

If you need write access to the sample folder I would recommend changing it at this location:

https://github.com/christophhart/HISE/blob/73e0e299493ce9236e6fafa7938d3477fcc36a4a/hi_core/hi_core/PresetHandler.cpp#L1221

This prevents unnecessary preprocessor branching in the sampler classes and catches all calls to getSubDirectory(FileHandlerBase::Samples).

If you wrap it into a preprocessor (something like HISE_IOS_ENABLE_WRITE_ACCESS_FOR_SAMPLE_DIRECTORY), then I'm happy to accept the pull request, but I wouldn't make it the default.

christoph-hart avatar May 05 '22 07:05 christoph-hart