Forum
    • Categories
    • Register
    • Login

    Saving MIDI CC assignments in user presets?

    Scheduled Pinned Locked Moved Scripting
    60 Posts 4 Posters 5.0k 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.
    • dannytaurusD
      dannytaurus @David Healey
      last edited by dannytaurus

      @David-Healey Sounds like you might want the truly global behaviour that I ultimately decided against.

      If you enable both preprocessors (by setting them to 0 since 1 is default and current behaviour) :

      HISE_MIDI_AUTOMATION_IN_USER_PRESETS=0
      HISE_MIDI_AUTOMATION_IN_PLUGIN_STATE=0
      

      then NO mappings will be saved per-preset, NO mappings will be loaded from a saved DAW session state, and NO mappings will be loaded when the user changes presets.

      Every preset saved by the user will have zero mappings.
      Every instance of the plugin freshly loaded in a new DAW will have zero mappings.
      Every instance of the plugin loaded from a saved DAW session will have zero mappings.
      Every additional instance of the plugin loaded into a DAW will have zero mappings.

      Then all you have to do is wire up your global mappings file to the plugin-load and preset-load callbacks.

      I decided against this approach because:

      1. This will overwrite a user's saved custom mappings with global when a saved DAW session is reloaded
      2. When loading a fresh instance of the plugin, the global mappings will load, which might not be what the user wants
      3. When changing presets, the global mappings will be loaded, which might not be what the user wants.

      My take on those situations is:

      1. Load whatever mappings are in the saved DAW session because that's how the user saved them
      2. If the user wants to load mappings in a new instance of the plugin, it's just one "Load Default Mappings" button press
      3. When changing presets, I want whatever mappings are already there to stay there and not switch to the global ones.

      I hope all that makes sense. I was genuinely trying to answer as briefly as possible, but there's a lot going on! 😜

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

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

        @David-Healey By the way - you might have to extend my PR to include macros and MPE in the saved data. I'm only accounting for MIDI CC mappings because I haven't down any thing with macros or MPE in my plugins yet.

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

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

          @dannytaurus Aha I don't think that will help me then. The saving/loading I can do already, and I like having the fallback in the preset. The issue I have is that the updateCallbacks trigger multiple times and overwrite the data I've saved. I'll keep trying.

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

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

            @David-Healey Yeah, that's why I wanted a solution that didn't involve any plugin/preset callbacks at all.

            Just wanted zero mappings saved in the presets, and a nice clean MidiMappings.js save/load script.

            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 decided to see what Claude would do with the problem. It's a massive commit so I'm not going to rely on it, but I'll leave it here as it might be a starting point for Christoph - or who knows, maybe it's perfect!

              https://github.com/davidhealey/HISE/commit/adc0826307163d1e8781d8b024a2090233dfe0c9

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

              Christoph HartC 1 Reply Last reply Reply Quote 1
              • Christoph HartC
                Christoph Hart @David Healey
                last edited by

                Worked on this today:

                https://github.com/christophhart/HISE/commit/528ccf712722db6bb213470e40a0b4cb47f9775b

                I didn't use any preprocessors but a dynamic API call - there's no need for this to be a compile-time setting.

                You can define for each of macros, midi & mpe assignments whether they should be stored externally, in the user preset or in the plugin state.

                Docs:

                https://github.com/christoph-hart/hise_api_generator/blob/271ca2d159ce26e9077ec7638b1f41ea68ba2f3d/enrichment/phase4/auto/UserPresetHandler/setStateManagerProperties.md

                David HealeyD dannytaurusD 3 Replies Last reply Reply Quote 4
                • David HealeyD
                  David Healey @Christoph Hart
                  last edited by

                  @Christoph-Hart Oh nice, I'm going to dig into it this evening and try it out. Thanks!

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

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

                    @Christoph-Hart For expansions will it use one external xml file per expansion?

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

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

                      @David-Healey you can specify the file in the onInit callback so for rhapsody it should work if the developer keeps it tidy

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

                        @Christoph-Hart This system seems to work very well, haven't thoroughly tested it yet but in the standalone version of Rhapsody it's working as expected.

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

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

                          @Christoph-Hart Works great here! 👏

                          I'm only using it with the PluginState rather than External, which I think you're doing @David-Healey ?

                          SubStates: {
                              MidiAutomation: "PluginState"
                          }
                          

                          But it works great with all my scenarios.

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

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

                            @dannytaurus Yeah this is what I'm doing

                            	const automationDataFile = Expansions.getAppDataFolder().getChildFile("automation.xml");
                            	const automationDefaults = Engine.createMidiAutomationHandler().getAutomationDataObject(); // Pulls the defaults from the project on first run
                            
                            	const uph = Engine.createUserPresetHandler();
                            	
                            	uph.setStateManagerProperties({
                            	    SubStates: {
                            	        MidiAutomation: "External",
                            	        MPEData: "External",
                            	        macro_controls: "External"
                            	    },
                            	    ExternalFileDefault: {
                            	        MidiAutomation: automationDefaults
                            	    },
                            	    ExternalFile: automationDataFile.toString(automationDataFile.FullPath)
                            	});
                            

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

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

                            24

                            Online

                            2.4k

                            Users

                            13.9k

                            Topics

                            120.7k

                            Posts