Custom JSON preset file support
-
Hi, I’m working on a HISE FX plugin and wanted to ask whether there is any safe way in Hise to package native
.presetfiles into a single custom bank file without losing preset data.What I was trying to do:
- export a whole preset bank into one portable json file
- then import that file back into the plugin and recreate the original
.presetfiles
My first attempt was:
- read each
.presetwithloadFromXmlFile() - store the returned object inside a JSON container
- write that container with
writeObject() - read it back with
loadAsObject() - recreate each preset with
writeAsXmlFile()
Problem:
This appears to be lossy for real HISE preset files.
A native preset contains many repeated<Control>elements, andloadFromXmlFile()seems to collapse repeated child tags into a single object entry, so after round-trip only one control survives instead of the full preset.So my question is:
Is there any HISE-supported way in script to preserve the raw contents of a.presetfile for single-file bank export/import?More specifically, is there any API in Hise for:
- reading a file as raw text/string
- reading raw bytes/binary
- copying files into/from an archive-like container
- base64 encode/decode
- or any other safe way to round-trip a
.presetfile exactly
Any recommended approach here would be really appreciated.
-
Sounds like something that could easily get messy. What's the end goal?
-
@David-Healey essentially just to be able to export and import user preset banks. It seems like Hise cant import folders though? So I was trying to find another way
-
@dezertaudio said in Custom JSON preset file support:
essentially just to be able to export and import user preset banks.
If you're using the stock preset browser this functionality is built in.
