HISE Logo Forum
    • Categories
    • Register
    • Login

    Engine.saveUserPreset(value) in any dir?

    Scheduled Pinned Locked Moved Scripting
    6 Posts 3 Posters 277 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.
    • ulrikU
      ulrik
      last edited by ulrik

      Is it possible to redirect the

      Engine.saveUserPreset(value);
      

      to save in whatever folder inside "User Presets"?

      Hise Develop branch
      MacOs 15.3.1, Xcode 16.2
      http://musikboden.se

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

        @ulrik As far as I'm aware this only saves the currently loaded preset, it doesn't save a new preset. Or does it?

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

        ulrikU 1 Reply Last reply Reply Quote 0
        • ulrikU
          ulrik @d.healey
          last edited by

          @d-healey I'm working with my "compare" script and

          Engine.saveUserPreset(newName);
          

          will save the loaded preset that have been modified in to a new preset with a new name, and it's working nicely, however it saves the new preset into the same category folder as the original preset.
          I want the user to chose the category folder

          Hise Develop branch
          MacOs 15.3.1, Xcode 16.2
          http://musikboden.se

          A 1 Reply Last reply Reply Quote 1
          • A
            ally @ulrik
            last edited by

            @ulrik Did you happen to find a solution to this? Trying to do the same thing and having no luck

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

              @ally

              Yes it's possible. I posted a video about it on Patreon a couple of months ago showing how to prompt the user to select a location for the preset.

              Here's the code I'm using in one of my projects. I'm using expansions so you'll need to modify the first line in the function for non-expansion projects. (The version in the video is simpler).

                  inline function createNewPreset()
                  {
              		local userPresetsFolder = Expansions.getCurrentUserPresetsFolder();
              
              		if (!isDefined(userPresetsFolder))
              			return;
              
              	    FileSystem.browse(userPresetsFolder, true, "*.preset", function[userPresetsFolder](f)
              	    {
              			var grandparent = f.getParentDirectory().getParentDirectory().getParentDirectory();
              
              			if (!userPresetsFolder.isSameFileAs(grandparent))
              				return Engine.showMessageBox("Invalid Location", "Presets must be saved in a bank and category folder within the instrument's user presets folder.", 0);
              			Engine.saveUserPreset(f.toString(f.FullPath).replace(".preset"));
              	    });
                  }
              

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

              A 1 Reply Last reply Reply Quote 1
              • A
                ally @d.healey
                last edited by

                @d-healey Thank you!

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

                46

                Online

                1.7k

                Users

                11.7k

                Topics

                101.8k

                Posts