HISE Logo Forum
    • Categories
    • Register
    • Login

    Engine.loadUserPreset | Load Preset From Button

    Scheduled Pinned Locked Moved General Questions
    init presetpreset buttonloaduserpreset
    11 Posts 5 Posters 593 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.
    • trillbillyT
      trillbilly
      last edited by trillbilly

      Hey Gang,

      So I was trying to get a Button to load a Preset that I have saved as my "INIT" preset. Unfortunately, it didnt work. So I came on the forum to see what I was doing wrong and I came across a slew of threads about the

      Engine.loadUserPreset()
      

      function not working. Has this ever been fixed? Is there a work around that is reliable?

      Here is a snippet. I feel like I've done everything correctly here, yes?

      HiseSnippet 1145.3ocsV0raabCDlqrViJ01jFf9.rvnGjATMjxesHAAQVxRABwxQvxIs.FEAz6RIQ3cIEH4ZGgVCja8ZeD5CPuzGo1C8bu0ityrbk1U1xtxBn6Aaw42uY32Px9JoOSqkJhSoilNgQb9L2ASElwsFS4BR28HN2ysGUaXJOqnlSmP0ZV.wwYiWgBbJUjj782urIMjJ7YYhHj2I49r84QbSlz9MdMOLrCMfcDOJm0OtQWeonkLTFC3YC2ZjIT+SoiXGPQyJ3Rb1rc.2HUCLTCSC1zTFLcvX44Bq8uiq4mDxvE0ICf.YESZMlGFzeVspIDmh8yp7MrU9W51iGvmKOqC7EIJ7x7HeOvovsAo52AH4jCREsP5AtC7U7IlLMHd9T2tBXCYHEZ04gh0VRgeywskDrPX1IhdJqiBVL2iJOsVspdve194kK2VLhKX6LhYdqlo5qXZlYet1TAUxEgfRugwBeCWJ7jh8kzftBtoYrwfaTBiRFVwWFMQJfrU06LZXLa6x+XYO7iOrRh.uW7Bu5aW1JLMkgPnxxYks5dP2i1Bx5EPhmAd.VslE6JasXx2Z6czn5DHzhFFdBPUpbCPDhatp3.og8FQEDlkJeQYuqpZ3vkpKMVgL0RUiTY0s4XEQbzILUtlThgvd8hDnMWMBjusIkyPo.K72LgkttiLL.IF3uuNcij1kAhWgTDBlZRnc2Kk1YahDd.NCrXmkjTE4mzI2TTFDxCXpjnT1cOVj70B4IK3+u9p+3OeI4sc2iZn3fPJz.3NgoLbrq3rG6L3jD6XQIHL5SMxIPtlyPf4BS5brMuc.NlgKFcDG5dX1uuadQ0IeXN7+3wMllUKeUiT.Xy18csjzlJ44.ikbxnYGQUZSv5+AcgaXQYR+8K+kKWT5CSMN4KoLK7yEbw4jsvcvAzyXo75m4YTwrpyzz9CSnBMPjz6pgPEGgVLjFpyLIYeVM28EUhLZ80jhLNqC57ILSLLD.ULnqds4NsaPvxw3gLAb.8x0sGKjYtAccnmIUPOBO0eAHlBstPgGvZJUP4sf9Chir8BD80SDYW+c7.y3CgsXIn33jCbpsyitxW06nbP7OjjC7jwcUL57lSZFptr+M2KKxNTddeZP.v8VU+FvnJ+wMoplxXQ.VoGaUzSpRanWUSFM5pZl0pul1xWPNGaZDGWmexgPFy3iFavU+kcld9zk6pe1vMLX0XRCttmLBBGUAhcJjO9EWkSMxhbCYtH+wyZPt9smv81xf3PpYwKywWsjp.lqV3FT7VRfzYll+UM2ga3qcq2vupP7At84F+wKGiEVBFwyv+e.iouK5ycaObHy2jAvhtc9908QP+Go+PYLd.cOpQwgMaWXTe.b9oOCxtPvB0H0r.xLsqqgqwNv.lHHYwkvWpx53ZmTk0mojDQ8Ux26autBe40mjHAvjH4glkfW7Bq8pO6RJW2Z6TiDAOB7899X4+0vMpK2mGtF97n0vmGuF97j0vmmtF97MqgOe6s5C996ciMxH63.Hne6jaQcbZKn.yJgER9WLUoFxC
      
      ulrikU 1 Reply Last reply Reply Quote 0
      • ulrikU
        ulrik @trillbilly
        last edited by

        @trillbilly What if you change to

        Engine.loadUserPreset("INIT.preset");
        

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

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

          That won't work. Your button is set to save in preset, that will trigger the button's callback each time a preset loads and create an endless loop.

          You don't need an init preset. Just load the preset you want to be the init state before you compile your project and that will be the initial state the plugin is in when the user opens it.

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

          trillbillyT 1 Reply Last reply Reply Quote 0
          • trillbillyT
            trillbilly @d.healey
            last edited by

            @d-healey but what if I want a quick way for users to reset the default values without having to search the Preset browser?

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

              @trillbilly Then have a button on the UI that isn't set to saveInPreset that can be used to load a preset.

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

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

                Also you need to pass in a file object or path, not a preset name:

                819cf7d2-2a31-4855-963f-db68f507f985-image.png

                Here's an example: loadPresetTest.zip

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

                trillbillyT huen97H 2 Replies Last reply Reply Quote 0
                • trillbillyT
                  trillbilly @d.healey
                  last edited by

                  @d-healey Aayaya (my Mario voice), I got it, thank you...

                  1 Reply Last reply Reply Quote 1
                  • huen97H
                    huen97 @d.healey
                    last edited by

                    @d-healey why this example not working for me 😖 , I am trying to use the button to load the presets , but fail.....

                    trillbillyT 1 Reply Last reply Reply Quote 0
                    • trillbillyT
                      trillbilly @huen97
                      last edited by trillbilly

                      @huen97 its set up like this

                      inline function onResetButtonControl(component, value)
                      {
                      	Engine.loadUserPreset("Factory/INIT.preset");
                      };
                      
                      Content.getComponent("ResetButton").setControlCallback(onResetButtonControl);
                      

                      with "Factory/INIT.preset" being the File Loaction and name or preset.

                      Y 1 Reply Last reply Reply Quote 0
                      • Y
                        yall @trillbilly
                        last edited by

                        @trillbilly otherwise in the callback of your Button, put the state of each button or setting of your project. longer to perform but if the "init" preset is deleted, this function will remain unchanged

                        trillbillyT 1 Reply Last reply Reply Quote 1
                        • trillbillyT
                          trillbilly @yall
                          last edited by

                          @yall Didnt think of this. Great observation!

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

                          33

                          Online

                          1.7k

                          Users

                          11.8k

                          Topics

                          102.7k

                          Posts