Forum
    • Categories
    • Register
    • Login

    Saving MIDI CC assignments in user presets?

    Scheduled Pinned Locked Moved Scripting
    61 Posts 4 Posters 6.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ustkU
      ustk @dannytaurus
      last edited by ustk

      @dannytaurus Oh yes absolutely, active in the sense of "armed track", then 100% yes 👍

      Hise made me an F5 dude, any other app just suffers...

      dannytaurusD 1 Reply Last reply Reply Quote 1
      • dannytaurusD
        dannytaurus @ustk
        last edited by

        @ustk Yes, 'active' is too ambiguous a word to have used in the first place. My bad.

        Meat Beats: https://meatbeats.com
        Klippr Video: https://klippr.video

        ustkU 1 Reply Last reply Reply Quote 0
        • ustkU
          ustk @dannytaurus
          last edited by

          @dannytaurus The honour of badness is mine 😁

          Hise made me an F5 dude, any other app just suffers...

          1 Reply Last reply Reply Quote 0
          • David HealeyD
            David Healey @ustk
            last edited by

            @ustk said in Saving MIDI CC assignments in user presets?:

            So the working solution is

            I think there's more to it, at least if you're saving/loading it from a file.

            setUpdateCallback is triggered before on init and setPreCallback is only triggered when loading a preset.

            So we need it to be that when we make a change to automation we save the the object to a file.
            Then at init we load that object from the file using setAutomationDataFromObject
            And during preload we pass the object into preset data.

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - HISE tutorials
            My Patreon - More HISE tutorials

            ustkU 1 Reply Last reply Reply Quote 0
            • ustkU
              ustk @David Healey
              last edited by ustk

              @David-Healey Absolutely, then the mah.setUpdateCallback allows you to easily write the file, that's why I said "or just rewrite what you already saved" in the post above

              Hise made me an F5 dude, any other app just suffers...

              David HealeyD 1 Reply Last reply Reply Quote 1
              • David HealeyD
                David Healey @ustk
                last edited by

                @ustk Yeah I've got it working now. I've set it to fall back to the preset's automation if the one loaded from the file is empty. That way I can setup my "defaults" in the preset file.

                Free HISE Bootcamp Full Course for beginners.
                YouTube Channel - HISE tutorials
                My Patreon - More HISE tutorials

                ustkU 2 Replies Last reply Reply Quote 1
                • ustkU
                  ustk @David Healey
                  last edited by

                  @David-Healey said in Saving MIDI CC assignments in user presets?:

                  That way I can setup my "defaults" in the preset file.

                  Clever! 👍

                  Hise made me an F5 dude, any other app just suffers...

                  1 Reply Last reply Reply Quote 0
                  • ustkU
                    ustk @David Healey
                    last edited by

                    @David-Healey Till today I wasn't aware of this setEnableUserPresetPreprocessing, this will save me from other situations where I was tinkering with the pre/post save/load in order to keep parameters persistent...
                    I'll keep that in mind now!

                    Hise made me an F5 dude, any other app just suffers...

                    Christoph HartC dannytaurusD 2 Replies Last reply Reply Quote 1
                    • Christoph HartC
                      Christoph Hart @ustk
                      last edited by Christoph Hart

                      the Midi CC settings are part of the data model of a user preset that is saved in the DAW project, otherwise it would loose the connections when you reload a DAW project.

                      If you want to clear the Midi assignments when browsing user presets, you can easily just clear it in the post load callback and guard it behind the !uph.isInternalPresetLoad() check.

                      And any Midi CC connection reacts the same way as note input, so if you have armed multiple tracks it will control multiple instances. Feature, not a bug.

                      dannytaurusD 1 Reply Last reply Reply Quote 0
                      • dannytaurusD
                        dannytaurus @Christoph Hart
                        last edited by dannytaurus

                        @Christoph-Hart said in Saving MIDI CC assignments in user presets?:

                        the Midi CC settings are part of the data model of a user preset that is saved in the DAW project

                        Are you referring here to the saved DAW session, or the saved user preset? Or both?

                        Saving as part of the DAW session is cool, I just don't want them saved in the user presets.

                        Meat Beats: https://meatbeats.com
                        Klippr Video: https://klippr.video

                        Christoph HartC 1 Reply Last reply Reply Quote 0
                        • Christoph HartC
                          Christoph Hart @dannytaurus
                          last edited by

                          @dannytaurus HISE treats a user preset and a DAW state exactly the same - it reloads everything in the data model including the CC assignments.

                          If you want to distinguish between the two, you need this method:

                          https://docs.hise.audio/scripting/scripting-api/userpresethandler/index.html#isinternalpresetload

                          I wouldn't start hacking around in the source code for this, the data model needs to stay consistent, this is just an UX problem while preset browsing that you can solve easily on the script level.

                          dannytaurusD 2 Replies Last reply Reply Quote 0
                          • dannytaurusD
                            dannytaurus @ustk
                            last edited by

                            @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.

                            Meat Beats: https://meatbeats.com
                            Klippr Video: https://klippr.video

                            1 Reply Last reply Reply Quote 0
                            • dannytaurusD
                              dannytaurus @Christoph Hart
                              last edited by dannytaurus

                              @Christoph-Hart I don't really want lies in my user preset data. Might be confusing to anyone who read/edits the XML

                              Meat Beats: https://meatbeats.com
                              Klippr Video: https://klippr.video

                              1 Reply Last reply Reply Quote 0
                              • dannytaurusD
                                dannytaurus @Christoph Hart
                                last edited by

                                @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.

                                Meat Beats: https://meatbeats.com
                                Klippr Video: https://klippr.video

                                Christoph HartC 1 Reply Last reply Reply Quote 0
                                • ustkU
                                  ustk
                                  last edited by

                                  So my solution is incomplete because it doesn't restore CC with session... Back to Chris solution...

                                  Hise made me an F5 dude, any other app just suffers...

                                  1 Reply Last reply Reply Quote 0
                                  • Christoph HartC
                                    Christoph Hart @dannytaurus
                                    last edited by

                                    @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).

                                    dannytaurusD 1 Reply Last reply Reply Quote 0
                                    • dannytaurusD
                                      dannytaurus @Christoph Hart
                                      last edited by

                                      @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.

                                      Meat Beats: https://meatbeats.com
                                      Klippr Video: https://klippr.video

                                      dannytaurusD 1 Reply Last reply Reply Quote 0
                                      • dannytaurusD
                                        dannytaurus @dannytaurus
                                        last edited by dannytaurus

                                        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:

                                        1. 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."

                                        2. 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."

                                        3. 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."

                                        4. 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.

                                        CleanShot 2026-07-11 at 13.25.30@2x.png

                                        Meat Beats: https://meatbeats.com
                                        Klippr Video: https://klippr.video

                                        David HealeyD 1 Reply Last reply Reply Quote 1
                                        • David HealeyD
                                          David Healey @dannytaurus
                                          last edited by

                                          @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.

                                          Free HISE Bootcamp Full Course for beginners.
                                          YouTube Channel - HISE tutorials
                                          My Patreon - More HISE tutorials

                                          1 Reply Last reply Reply Quote 2
                                          • David HealeyD
                                            David Healey
                                            last edited by

                                            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.

                                            Free HISE Bootcamp Full Course for beginners.
                                            YouTube Channel - HISE tutorials
                                            My Patreon - More HISE tutorials

                                            1 Reply Last reply Reply Quote 3
                                            • First post
                                              Last post

                                            25

                                            Online

                                            2.5k

                                            Users

                                            13.9k

                                            Topics

                                            120.9k

                                            Posts