Saving MIDI CC assignments in user presets?
-
@ustk From what Claude says, this is minimally useful for my situation.
Although you can preprocess the preset data before loading it, you still have to set all the values to something, meaning you can't just say "don't overwrite the existing CC assignments". I suppose you could read the current assignments, then preprocess to replace the preset assignments with the current ones. Phew!
But as I replied to David earlier, that leads to there being lies on disk.
-
@Christoph-Hart I don't really want lies in my user preset data. Might be confusing to anyone who read/edits the XML
-
@Christoph-Hart said in Saving MIDI CC assignments in user presets?:
If you want to distinguish between the two, you need this method:
https://docs.hise.audio/scripting/scripting-api/userpresethandler/index.html#isinternalpresetload
Personally, I don't need to distinguish between a DAW session reload and a preset load. I just want no MIDI CC data saved to, or loaded from, user presets.
-
So my solution is incomplete because it doesn't restore CC with session... Back to Chris solution...
-
@dannytaurus said in Saving MIDI CC assignments in user presets?:
Personally, I don't need to distinguish between a DAW session reload and a preset load. I just want no MIDI CC data saved to, or loaded from, user presets.
Of course you need to distinguish between a DAW session and a user preset, you want the CC assignments to be retained when loading a DAW project, no?
It's pretty simple: the data model that drives the plugin state MUST include the CC assignments. If you want you can strip it out of the user preset system with the script callbacks (or you can hack around in your local source code but there's no chance of this making it upstream).
-
@Christoph-Hart said in Saving MIDI CC assignments in user presets?:
Of course you need to distinguish between a DAW session and a user preset, you want the CC assignments to be retained when loading a DAW project, no?
Not if someone wanted a truly global system. But that use case has too many downsides for me, so I'm going for per-instance restore and no CC in preset data.
-
Here's the PR with the preprocessors. I already closed it but leaving it rather than deleting in case the specifics help anyone.
https://github.com/christophhart/HISE/pull/995
The two preprocessors:
HISE_MIDI_AUTOMATION_IN_USER_PRESETS // load/save CC mappings from preset data? HISE_MIDI_AUTOMATION_IN_PLUGIN_STATE // load/save CC mappings from session data?Allow you to set up any of four scenarios:
-
U=1, P=1 (default): "I want CC mappings to be part of the sound, recalled with every preset, and I also want each plugin instance to remember them in the DAW session."
-
U=0, P=1 (per-instance): "I don't want browsing presets to touch the user's CC mappings, but I do want each instance to remember its own mappings when the DAW session reopens."
-
U=0, P=0 (global, script-owned): "I don't want presets or DAW sessions storing CC mappings at all, because I want one global mapping file that my script owns and every instance shares."
-
U=1, P=0 (odd but technically valid): "I want CC mappings treated purely as patch data that loads with each preset, but I don't want sessions keeping their own separate copy that could drift from whatever preset is loaded."
I'm going for the per-instance approach plus manual [Save As Default Map] and [Load Default Map] buttons in my UI.
Feels like the best approach for my synth, and what I would want as a user.

-
-
@dannytaurus I think option 3 is what I want. I'd like it to be seamless. The user assigns a CC to a control and that's it. They can change presets, add new instances, reload the DAW sessions, etc. and their assignments stick.
I'm trying to get it working just via scripting but it's actually a real pain, the settings keep getting overwritten. It might be because I'm using expansions rather than it being a plugin. I'll keep trying.
-
Finally got it working. I had to add several flags to guard against my save to file function running and overwriting the stored CC values.
-
I'm still hitting some bugs with this.
@Christoph-Hart I think you should take a look into this because it is a very good point.
So far I haven't really ran into this situation because most of my projects only have one or two presets. But I'm developing a project at the moment that might have 100 or more presets and this will definitely be an issue.
If a user has a set of CCs they like to work with then they likely want to set it up once for the entire instrument (all presets past, present, and future) and forget about it. They don't want to have to redo it each time they add an instance of the plugin.
With this instrument wide setup I don't see a reason to distinguish between daw load or user preset because the source of truth will be a separate file that can be read in both situations.
I'm currently trying to implement a working solution through scripting but I'm running into annoying issues with
setUpdateCallbackbecause it fires at init - it fires multiple times when using full instrument expansions. I'm gating it currently with flag variables but still haven't got it working reliably yet, and the code is a tangle.-- Should also include macros and MPE assignments too.