HISE Logo Forum
    • Categories
    • Register
    • Login

    Parse getUserPresetList() output into 2d array

    Scheduled Pinned Locked Moved General Questions
    40 Posts 6 Posters 799 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.
    • 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+5aNkHHRJqTEB8VEmx5yi35RsCZ98bgnKIjcAOph2urYOpR1RITSA7rg6AnXB8RxX14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.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
                          • d.healeyD
                            d.healey @Morphoice
                            last edited by

                            @Morphoice If I'm understanding correctly you have the preset name in the label's text/value, so what about

                            Engine.loadUserPreset(value);

                            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 just the preset name, not the full path to the preset, it needs the full path to load

                              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 Isn't it a hidden label and meant to store the full path?

                                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 if I understood lindon's approach correctly, the combo box is what's hidden, the label displays the name, at least that's what I got from his snippet

                                  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 Then I defer to Lindon.

                                    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 Morphoice

                                      @Lindon @d-healey I guess the text label could also be invisible and the combobox visible so I get the full path in the label callback

                                      but if I call loadUserPreset there it just runs into a loop loading the preset and outputting hundreds of console messages until HISE crashes after a minute or so

                                      const var Presets = Content.getComponent("Presets"); // The Combobox
                                      const var CurrentPreset = Content.getComponent("CurrentPreset"); // The Label
                                      
                                      inline function onPresetsControl(component, value)
                                      {
                                      	if (!value)
                                      		return;
                                      
                                      	local presetPath = Engine.getUserPresetList()[value - 1];
                                      	CurrentPreset.set("text", presetPath);
                                      	CurrentPreset.changed();
                                      }
                                      Presets.setControlCallback(onPresetsControl);
                                      
                                      inline function onCurrentPresetControl(component, value)
                                      {
                                      	Engine.loadUserPreset(value+".preset");
                                      	Console.print(value);
                                      };
                                      CurrentPreset.setControlCallback(onCurrentPresetControl);
                                      
                                      

                                      if I put the loadUserPreset into the combobox callback it hangs compiling and crashes after a while too

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

                                      d.healeyD LindonL 2 Replies Last reply Reply Quote 0
                                      • d.healeyD
                                        d.healey @Morphoice
                                        last edited by

                                        @Morphoice You need to disable saveInPreset for the component that is loading the preset, otherwise you get an infinite loop.

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

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

                                          @Morphoice so in your combobox callback that is setting the label -, you need a switch that says "hey time to load a preset", that the label (which is saveInPreset) reads and ONLY loads if this == true,

                                          HISE Development for hire.
                                          www.channelrobot.com

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

                                          40

                                          Online

                                          1.7k

                                          Users

                                          11.7k

                                          Topics

                                          102.3k

                                          Posts