HISE Logo Forum
    • Categories
    • Register
    • Login

    Content.storeAllControlsAsPreset

    Scheduled Pinned Locked Moved Scripting
    31 Posts 5 Posters 2.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.
    • Christoph HartC
      Christoph Hart
      last edited by

      What if you could just pass a ScriptFile object into these methods:

      Engine.loadUserPreset( String relativePathWithoutFileEnding)
      Engine.saveUserPreset(String presetName);
      

      Then you can create subfolders, add new files etc. as much as you want.

      const var f = FileSystem.getFile(FileSystem.UserPresets).getChildFile("MyFunkySubFolder/AnotherSubFolder/3LevelSubfolder/Mindblowing4LevelSubfolder/Preset.preset");
      
      Engine.saveUserPreset(f);
      

      The old functionality will remain the same (so passing in a String will do whatever it does now).

      d.healeyD Dan KorneffD 2 Replies Last reply Reply Quote 4
      • d.healeyD
        d.healey @Christoph Hart
        last edited by

        @Christoph-Hart Looks good!

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

        1 Reply Last reply Reply Quote 0
        • Dan KorneffD
          Dan Korneff
          last edited by

          That's perfect!

          Dan Korneff - Producer / Mixer / Audio Nerd

          1 Reply Last reply Reply Quote 0
          • Dan KorneffD
            Dan Korneff
            last edited by

            my only gripe with saveUserPreset() is that you have to load a preset first.
            I had a method where I loaded an empty preset before saveUserPreset(), which was working great on everthing EXCEPT protools :( It didn't like the empty preset.

            Is there some method I'm overlooking to load a preset without changing your current control settings? It just seems backwards to me 🙃

            Content.storeAllControlsAsPreset() was great cause you could skip the whole "load a preset first" thing.

            Dan Korneff - Producer / Mixer / Audio Nerd

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

              @dustbro all a preset does is store and restore control settings, so what would be the point of a preset that didn't change the controls when loaded?

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

              Dan KorneffD 1 Reply Last reply Reply Quote 0
              • Dan KorneffD
                Dan Korneff @d.healey
                last edited by

                @d-healey that's kind of my point. You can't use saveUserPreset() without first calling loadUserPreset() or else the newly saved preset will be created in an unexpected location.
                From my testing, you have to load an existing preset within the sub folder location you want to save to. Then saveUserPreset() makes a duplicate (child? ) of that file and saves the new data to it.
                So if you want to save your current settings as a preset, having to loading a preset first (which would change your controls) seems counterintuitive.
                Maybe @Christoph-Hart could clarify

                Dan Korneff - Producer / Mixer / Audio Nerd

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

                  @dustbro ah I see the problem now, I think the changes proposed by Christoph will solve this already.

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

                  1 Reply Last reply Reply Quote 0
                  • Dan KorneffD
                    Dan Korneff @Christoph Hart
                    last edited by

                    @Christoph-Hart said in Content.storeAllControlsAsPreset:

                    Then you can create subfolders, add new files etc. as much as you want.

                    @Christoph-Hart Any chance we can get this update on your radar?

                    Dan Korneff - Producer / Mixer / Audio Nerd

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

                      Alright, Engine.loadUserPreset() accepts a file object now, so the minimal setup for loading and storing user presets via the native file browser is:

                      function load(file)
                      {
                          Engine.loadUserPreset(file);
                      }
                      
                      function save(file)
                      {
                          Engine.saveUserPreset(file);
                      }
                      
                      // Place this anyway you like (button callbacks, whatever)...
                      var shouldLoad = true;
                      
                      if(shouldLoad)
                          FileSystem.browse(FileSystem.UserPresets, false, "*.preset", load);
                      else
                          FileSystem.browse(FileSystem.UserPresets, true, "*.preset", save);
                      
                      Dan KorneffD 2 Replies Last reply Reply Quote 4
                      • Dan KorneffD
                        Dan Korneff @Christoph Hart
                        last edited by

                        @Christoph-Hart tenor.gif

                        Dan Korneff - Producer / Mixer / Audio Nerd

                        1 Reply Last reply Reply Quote 2
                        • Dan KorneffD
                          Dan Korneff @Christoph Hart
                          last edited by

                          @Christoph-Hart said in Content.storeAllControlsAsPreset:

                          FileSystem.browse(FileSystem.UserPresets, true, "*.preset", save);

                          @Christoph-Hart Is there a way to default the browser to open the User Presets folder when using this save function? I have FileSystem.UserPresets set, but the system browser opens the last location you've navigated to.

                          Dan Korneff - Producer / Mixer / Audio Nerd

                          1 Reply Last reply Reply Quote 2
                          • Dan KorneffD
                            Dan Korneff
                            last edited by

                            Can you guys help me track down a crash I'm getting when using Engine.saveUserPreset()?

                            Here's a simplified script to check out.
                            If I hit hit the button to create a preset called "test" and then hit the button again and either select an existing preset to replace or type "test" again, HISE crashes.

                            HiseSnippet 1067.3ocsV0raaaDDdorYZjRUPCPP6UBcRpPUUJ0oo.AEQwxREBI1QHLIn2rWQtTZgI2kX4RaqFXzhh9FzWf9lz.zWf9FzGg1i8l5rKIEW4Z6DH.qSZ94a1uY1YlkSDbORRBWfrp9pEwDj0Ga6tfImOXNlxPi2CYcW68wIRhvIS0tKhwIIDejk0VemRgU0sQ5e+yS1EGhYdjRUHza3TOxyoQTYo1I8eFMLbD1m7JZjg26zerGmMfGxSA9rkcWTL16X7LxAXkaUrQV2ZnOUxEtRrjjfr1dWt+B247SYY9+FZBcZHQIzC4BAJS8HdnuhwJsnAyog9SJx6DDDkIkUgsxpB22depOck9xpwmnM3ThvrdXU45nWOS508CmdVFza6L5cOaWOAMVVZQws6XOlAWTAX3JvjVY9hp7GUrGvAOXxNQ3iIiDfvJDM2oa21NO3gca8350pWCtHRjNmfENOGOkD1y4acJvNiHGvih4LPnYiLyMTnJwrapTxYWMnb6MxNq50TXhEjCCTUBA.aDMj3t.Z6hTH0EHQSCkCOKFyRnvA1RGZUQSYtYiWm.AXhfjPjIeoRn3+qNrfTlmDf5jfOgzL.P0pds2VulC7aHaFkQ5nrThMyG.84YAfxBAmbVEGWv6bO8Jxw1PcHL0Hxz.mlEpTx4pU+LxqoB9oIDyL0HEZ6HEoj1NM97NwZMMZqygVO1IKX.+NWmjumpdmDkdlTvCGfCCmBSYMKSBUltJ23rC3RxKXMaU6s0pV67ZNWzTPvkZKO9gv81kYVM4KtNfMYoQSIhh5XgivHv5yX1W8Ll4J.urJhgib1XFU9hXB6pl7P4kQ0LXNq.Wk5Iv54Sf51eDElytsc1n.RSXCYzqGuGVhKhBDP3PhIBIUweq8Hm.qHylqqZuGI4XIOV6a9EGnd8ybBls5L0+uG5Ly0vKLD98So9x4qT7tet+bBc17xsw8+w9SmUrys5sVtb4eoTSgduRsnk+xupzJImIK092Ue5epzZUwfqeTFWuaNWy54zjspcdCnAa+si5Wx1e5Y8iwBHJFgaUFRS1mGApvB.fUEUe+XVVCqZGGx.ycduWQkD3cuzf.GcT+0KW84WrbgFeMbzrPBttT4e.bk6R+g0dla8hakO6S+Wk9KjRUP++89vqOb+zPrb8mjTuCma.lgVa2uZ+NrnTZ1S7jaj2o9Po68rmPkdyub9V4R3qpA6Flu4u5W2dXP.wSVR1ssG8827OwidIOURYy1GKETn2z9fzHWn6vi.LgAsVp8bPCgBpVtqRVUYbILes.L2tL2XOkrUtwdEFQQXOA+Pur8Xpuq31ZM.mX5OupJ7cdfrypEX11c6zEEAetygddpRwW.b+xw7fM.yWsAX1YCv7vM.yWuAXdzFf4atVLpuz7ooRdT1XBnXxP8KIVVCYXnKS2Qh9ObLm2n.
                            

                            Dan Korneff - Producer / Mixer / Audio Nerd

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

                            37

                            Online

                            1.7k

                            Users

                            11.7k

                            Topics

                            102.2k

                            Posts