HISE Logo Forum
    • Categories
    • Register
    • Login

    Product Versioning...and presets...

    Scheduled Pinned Locked Moved General Questions
    5 Posts 3 Posters 285 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.
    • LindonL
      Lindon
      last edited by Lindon

      OK so....

      I have a Product - released and out in the wild - with its own set of FACTORY presets

      Now I want to do version 1.1 of it, but.......

      I want to change the name of a widget, lets say from mySpecificPurposeGain to myGeneralPurposeGain.

      mySpecificPurposeGain is "saveInPreset" = true...

      So I have a set of FACTORY presets that all need changing one way or another - I can simply run a little python replace script that changes the name in all FACTORY presets....and these would be OK - I think - but a supplemental question on this later...

      But.. what about all those end-user presets - they would now be broken....and clearly I have no way to fix them....

      How does every one approach this "problem situation"?

      Clearly the simplest answer is NEVER go changing the name of a widget...but beyond that?

      Also (supplementary q now..) I assume when people upgrade the plugin - the first time it reinstalls the presets?

      HISE Development for hire.
      www.channelrobot.com

      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @Lindon
        last edited by

        There is a rebuildUserPresets function, but this only works for expansions, might be good if this could be triggered for non-expansion instruments if it detects a difference between preset versions - not sure how that would work.

        Another option is the setEnableUserPresetPreprocessing I have no idea what it does but I feel it should be useful in this situation.

        I think the approach most people have used up to now is to include a post-install script that handles UserPreset updates for presests that are already installed on the user's system.

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

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

          I haven't got around writing the docs for this class, but like @d-healey said, the UserPresetHandler is tailored to exactly this task.

          Link Preview Image
          HISE | Scripting | UserPresetHandler

          An object for customizing the data model

          favicon

          (docs.hise.audio)

          You can register a function with this method that will then convert every user preset to a JSON object which you can manipulate before loading the preset. In this case it would be something like

          const var up = Engine.createUserPresetHandler();
          up.setEnableUserPresetPreProcessing(function(data)
          {
              for(d in data.Content)
              {
                  if(d.name == "mySpecificPurposeGain")
                      d.name = "myGeneralPurposeGain";
              }
          }, false);
          

          I typed this out of my head, so there will be typos, but this is all you need to do for your use case and will cover factory presets as well as user made ones (since this operation is being executed everytime a preset is being loaded).

          d.healeyD 1 Reply Last reply Reply Quote 3
          • d.healeyD
            d.healey @Christoph Hart
            last edited by d.healey

            @christoph-hart Does this function overwrite the preset on the user's system? Does the function need to return the data object or is it passed by reference and edited in place?

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            Christoph HartC 1 Reply Last reply Reply Quote 0
            • Christoph HartC
              Christoph Hart @d.healey
              last edited by

              @d-healey No, it will not override the files, but just process the data that is being loaded (think of it as a non-destructive processing step).

              The data object is passed by reference and converted back to the XML format. Writing a XML->JSON converter is less trivial than you might think...

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

              43

              Online

              1.8k

              Users

              12.0k

              Topics

              104.1k

              Posts