HISE Logo Forum
    • Categories
    • Register
    • Login

    Parse getUserPresetList() output into 2d array

    Scheduled Pinned Locked Moved General Questions
    40 Posts 6 Posters 797 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 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

                              53

                              Online

                              1.7k

                              Users

                              11.7k

                              Topics

                              102.2k

                              Posts