HISE Logo Forum
    • Categories
    • Register
    • Login

    Parse getUserPresetList() output into 2d array

    Scheduled Pinned Locked Moved General Questions
    40 Posts 6 Posters 795 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.
    • whoopsydoodleW
      whoopsydoodle @d.healey
      last edited by

      @d-healey Perfect!

      1 Reply Last reply Reply Quote 0
      • whoopsydoodleW
        whoopsydoodle @d.healey
        last edited by whoopsydoodle

        @d-healey the code you wrote is super helpful but I've run into an issue when the user saves a preset.

        My thought was to call your populatePresetsMenu(); function again after the save dialog. This does reload the file structure and properly gets the new preset file. But for some reason the formatting gets lost. It all comes in as a single list with items displaying :: in their name after folder names.

        I don't really follow why it would do that since the first thing that function does is wipe out the items and repopulate the same as it does onInit. Not sure why it would come back borked up a second time when the same function is fine the first time around.

        The next thing I would like to do is have the newly saved preset selected in the combobox.

        These two seem like they should be straight forward building off your script but I'm not having much luck.

        Matt_SFM 1 Reply Last reply Reply Quote 0
        • Matt_SFM
          Matt_SF @whoopsydoodle
          last edited by

          @whoopsydoodle said in Parse getUserPresetList() output into 2d array:

          But for some reason the formatting gets lost. It all comes in as a single list with items displaying :: in their name after folder names.

          Which HISE build are you on ? This has been fixed in the develop branch.

          Develop branch
          Win10 & VS17 / Ventura & Xcode 14. 3

          whoopsydoodleW 1 Reply Last reply Reply Quote 0
          • Oli UllmannO
            Oli Ullmann @d.healey
            last edited by

            @d-healey
            Hey David,

            I wanted to script something like this for my new plug-in. Is it ok if I use your script as a starting point for my script?

            It is not an open source plug-in but a commercial product.

            All the best
            Oli

            d.healeyD 1 Reply Last reply Reply Quote 1
            • d.healeyD
              d.healey @Oli Ullmann
              last edited by d.healey

              @Oli-Ullmann Go for it.

              Unless I specifically say otherwise, any code I post directly on the forum can be used by anyone for any purpose.

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

              Oli UllmannO 1 Reply Last reply Reply Quote 2
              • Oli UllmannO
                Oli Ullmann @d.healey
                last edited by

                @d-healey
                That's great, thank you very much! :-) If you ever need anything (in the area of sound design, demo songs or similar), feel free to get in touch! :-) You are always a great help here!

                1 Reply Last reply Reply Quote 1
                • whoopsydoodleW
                  whoopsydoodle @Matt_SF
                  last edited by

                  @Matt_SF said in Parse getUserPresetList() output into 2d array:

                  This has been fixed in the develop branch.

                  Yep. That was it. Thanks. All good now with current build.

                  Anyone have any suggestions on how to have the menu select the currently loaded preset from it's items?

                  whoopsydoodleW 1 Reply Last reply Reply Quote 0
                  • whoopsydoodleW
                    whoopsydoodle @whoopsydoodle
                    last edited by

                    Is there something other than getCurrentUserPresetName() that will return the full path of the current preset not just the name? If there is then I can compare it against the output of getUserPresetList() to get an index for the current preset and then select that index in the combo box.

                    whoopsydoodleW 1 Reply Last reply Reply Quote 0
                    • whoopsydoodleW
                      whoopsydoodle @whoopsydoodle
                      last edited by

                      Never mind. I figured it out.

                      1 Reply Last reply Reply Quote 0
                      • MorphoiceM
                        Morphoice @d.healey
                        last edited by

                        @d-healey This is super helpful thank you so much, I already had a one-dropdown version made but this allows to have the entire tree of plugins. Brilliant! Is there a simple solution to have the current preset stored when the plugin opens? It makes no sense storing the combo boxes value in a preset, so I wonder if there is another way to save what preset is currently loaded and have that open in the preset browser from the start

                        https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

                        LindonL 1 Reply Last reply Reply Quote 0
                        • LindonL
                          Lindon @Morphoice
                          last edited by Lindon

                          @Morphoice said in Parse getUserPresetList() output into 2d array:

                          @d-healey This is super helpful thank you so much, I already had a one-dropdown version made but this allows to have the entire tree of plugins. Brilliant! Is there a simple solution to have the current preset stored when the plugin opens? It makes no sense storing the combo boxes value in a preset, so I wonder if there is another way to save what preset is currently loaded and have that open in the preset browser from the start

                          put the name of the preset you have loaded in a text box, and have the text box's callback do the loading, and have the text box saveInPreset. Now cover the text box with a combo box, use LAF to make its default state transparent - so now you see the text box - showing you the name of the preset, and when you click on it the combobox Dave has created shows up, you select a preset and the combobox callback changes the value in the text box and calls the textbox's changed() functionality to load the actual preset.

                          Added functionality here is you can change the order add and remove presets in the combobox list and your existing presets all still work/load fine.

                          eg.

                          HiseSnippet 1132.3ocsV0saiSDEdbZc0FWVztRbMZH2fqnp+sKKHsphzlefHR6FQJq3tUiGOIYnimwxdRaiP8AfK4Yg2.DOPbC2R4LicrcZCo6FI5EQ8767cNymOmYPhhxRSUIHm5WLKlgb9H2gyj5IslP3RTu1HmO18LRplkfyTc5rXRZJKD43rw2ZT3TeSj8u+5aNkHHRJqTEB8VEmx5yi35RsCZ98bgnKIjcAOph2urYOpR1RITSA7rg6AnXB8RxX14Dia0bQNa0IjqUIC0DMKE74TU3rgSTWKy7+s7TdffYDNDMDRTlZTqIbQ3f40ZJB4r4fxJeirJ+SbOiGxKzW1Adl0.tLhp8.mZqBRG9A.ImJPZyLH8b2gzDdrtzhAOa61SBWHiHPqtJTx7EU6O1vskB7Pp2KhbIqaBHTDg+qN3fcwvO67ZOOOnempwWQRv8IALwg3iwyCcLS2REEqjffeiLyMrAwkBtjgGMUR0bkDqjYVMQlnD9z4gsKjYwT1Nd+hWcvXpRv1KNgaxWuHrPQB4xwXBNNgkxzXJQHXg3F3uHOtW6cKbdqFP6kZTaO3VP7A.iw+d.xB5kfZHaApSU2rZfmkJyw32PytQ2XWbgeFL0Syht.z6uCbNy8lNgHGyB8WYITb9+WUw8A38txNE9Z6x17zXAYl009mzsxEHMgATx9Jns1Wot7DYXWFSXfj2xhbuD1Xt4C8t4cH+FgIjqmiAnrm257GuKVE7yP2Ai8pu+9Alr8Yd2Zg2HUB1mh4xpDoSDhh5N0uQicrc182eQRA03JzjApeCayjOZQc3iOF2HikW.qc7pCopN0zAePstr5zj35d0u0bwTgLbtRydiz2BLua8v22znQK0V9MifkrTylAbIqJPe4zn.VRUBmwQXBvhiU158arBMqmWwQkrmjqeSLKWtqRDZFWX9+GNDBkeoYFGkiPvUscXzSyGFYo3HNjim3lQ2QVvCfzsM4JFB8i8ZSzj44.RGbDwrDM2TINsYWA6DxFvU2sMK8RsJFFuWvPPNdO5IdSwZCbPyYEBMCZxf9Fw1Z.fCeWV.qT3mdxA1YMfwZAimupo9VGcze96l3ulGpmTtQ5hlSX7wS.2cc9Tjs8Tfwsyv3ybWjPZg41tEe5ZPpqyuAwVhRTPyHhUuKHvgAHPe4ysnzqOWFpjdmPfo1dmoRhmX1f58c8F1QBDkw2uL1HGxtNCfbsHbqVg2c2c+p4nMsjRsHz+72Y6jevtGXqmJbpfnWbUnYmetAfHuv9GyNFYJWOq5aB9.1OdvJ2O99Bwm6NfqoSVNFqsDLB7z+OvX9qJdpamQiXTcI.2zs6OstOg3QN9ePMUCqTOinS3F904SiFB2zTFb5RISjZXF0L73L4CLxlNvPlLzJ.zj6xMdnQ1I23gyMhhHzD06nYCGLua4IVM.lj1moUGduHHiKlJT1mifmQ8NJcwT8f.OZcC7EqafubcC7KW2.e05F3WstA90OdflW4dxTsJJ6yFD5rAcrCxcb5HMiTsrUz+Bo8RejC
                          

                          HISE Development for hire.
                          www.channelrobot.com

                          MorphoiceM 1 Reply Last reply Reply Quote 2
                          • MorphoiceM
                            Morphoice @Lindon
                            last edited by

                            @Lindon ingenious thank you!

                            https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

                            LindonL 1 Reply Last reply Reply Quote 0
                            • LindonL
                              Lindon @Morphoice
                              last edited by

                              @Morphoice no problem - works for all cases where you have a combobox and you may at some point want to add to, or reorder or remove any elements...

                              HISE Development for hire.
                              www.channelrobot.com

                              MorphoiceM 1 Reply Last reply Reply Quote 2
                              • MorphoiceM
                                Morphoice @Lindon
                                last edited by

                                @Lindon how do you get the full path of the preset to load from the label1 value? I only have the

                                I don't have that inside the label oncontrol only the displayed name. I only have the full path it in the combobox oncontrol. If I understand correctly the loading of the preset should be handled by the Label1

                                https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

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

                                  @Morphoice Use the user preset handler.

                                  Then in the post load callback you can store the reference to the preset file

                                  reg currentPresetFile;
                                  
                                  uph.setPostCallback(function(presetFile)
                                  {
                                  	currentPresetFile = presetFile;
                                  });
                                  

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

                                  MorphoiceM 1 Reply Last reply Reply Quote 1
                                  • MorphoiceM
                                    Morphoice @d.healey
                                    last edited by

                                    @d-healey what is uph?

                                    I loaded the preset like this inside the combobox callback
                                    but that doesnt work for the label

                                    Engine.loadUserPreset(Engine.getUserPresetList()[value - 1]+".preset");
                                    

                                    https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

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

                                      @Morphoice said in Parse getUserPresetList() output into 2d array:

                                      uph

                                      Reference to a user preset handler.

                                      const uph = Engine.createUserPresetHandler();

                                      Link Preview Image
                                      HISE | Docs

                                      favicon

                                      (docs.hise.audio)

                                      @Morphoice said in Parse getUserPresetList() output into 2d array:

                                      I loaded the preset like this inside the combobox callback
                                      but that doesnt work for the label

                                      What do you mean it doesn't work for the label?

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

                                      MorphoiceM 1 Reply Last reply Reply Quote 0
                                      • MorphoiceM
                                        Morphoice @d.healey
                                        last edited by

                                        @d-healey I'm wrong somewhere

                                        inline function onLabel1Control(component, value)
                                        {
                                        	Engine.loadUserPreset(Engine.getUserPresetList()[value - 1]+".preset");
                                        };
                                        Label1.setControlCallback(onLabel1Control);
                                        
                                        Interface: Factory Presets/Plucks/Echoes
                                        Interface: loading preset Echoes
                                        Interface:! presethandler.js (51): '-' is not allowed on the String type
                                        

                                        https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

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

                                          @Morphoice said in Parse getUserPresetList() output into 2d array:

                                          Engine.loadUserPreset(Engine.getUserPresetList()[value - 1]+".preset");

                                          This is only going to work in the combo box's callback. In a label's callback the value will be the label's text.

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

                                          MorphoiceM 1 Reply Last reply Reply Quote 0
                                          • MorphoiceM
                                            Morphoice @d.healey
                                            last edited by

                                            @d-healey exactly, hence my question how I can get to load it in the label :) don't I need to do that there instead of in the combo? Or am I missing the point?

                                            https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

                                            d.healeyD 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            54

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            102.1k

                                            Posts