Connecting script processor to external files
-
The tree structure of HISE allows a encapsulated design and enforces a "one module per task" policy.
However there are scenarios where you want this one task be applied at different places. If you have multiple samplers that should eg. have the same RR logic, you had to write one script, and duplicate the script processor in each submodule. However this increases the redudancy (the script code gets duplicated), and if you need to alter the behaviour, you had to change each script.
Luckily, these times are over now. You can now tell a script processor to be connected to an external file, and it will fetch its code directly from the file and morph into read-only mode.
- Write a script
- Save the script to a file within the project folder (both compressed and uncompressed script formats are supported)
- Right click on the header and choose Connect to external script. Select the file you've just exported.
- The editor & callback tabs will disappear and it will look like a Hardcoded script. You can now copy & paste it like any other module (the clones will also reference the file).
- When you made changes to the file, right click on the header and choose "Reload external script" (or simply choose Tools -> Recompile all scripts so you don't have to do this for every module that uses the file)
- If you need to disconnect the script processor (eg. to make local changes to the script), right click on the header and choose Disconnect from external script
If you export a plugin, it will of course embed the script into the binary / the HISE Player library package (just like with
include()
files) -
Excellent addition!
-
This seems to also work with scripts that aren't in the project folder, which is great if you have a library of modules that you want to use across multiple projects, but will they be emedded in the binary on export?
-
Yes of course. They are even embedded in a HISE Playe library.