HISE Logo Forum
    • Categories
    • Register
    • Login

    loadUserPreset - strange behaviour...

    Scheduled Pinned Locked Moved General Questions
    35 Posts 6 Posters 2.4k 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.
    • Dan KorneffD
      Dan Korneff
      last edited by

      Hey guys. I'm just starting to add user presets to my project. Having a little trouble getting them to load with a combo box.
      I've created 2 user presets in the PresetBrowser, but the interface designer doesn't show any control changes.
      Here's what I'm doing:

      const var ComboBox1 = Content.getComponent("ComboBox1");
      
      const var list = Engine.getUserPresetList();
      
      inline function onComboBox1Control(component, value)
      {
          switch (number)
      	{
      		case 1:
      		Engine.loadUserPreset(list[0]);
      		break;
      
      		case 2:
      		Engine.loadUserPreset(list[1]);
      		break;
      	}
      };
      
      Content.getComponent("ComboBox1").setControlCallback(onComboBox1Control);
      

      Dan Korneff - Producer / Mixer / Audio Nerd

      LindonL d.healeyD 2 Replies Last reply Reply Quote 0
      • LindonL
        Lindon @Dan Korneff
        last edited by Lindon

        @dustbro have you checked that list elements contain the correct data? Bit obvious but still...

        HISE Development for hire.
        www.channelrobot.com

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

          @dustbro

              switch (number)
          	{
          		case 1:
          		Engine.loadUserPreset(list[0]);
          		break;
          
          		case 2:
          		Engine.loadUserPreset(list[1]);
          		break;
          	}
          

          Use this instead : Engine.loadUserPreset(list[number-1]); it's not a fix to the issue it's just a much shorter way of writing the same thing. Where are you getting number from though?

          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 @Lindon
            last edited by

            @Lindon I believe so:
            script watch.PNG

            Dan Korneff - Producer / Mixer / Audio Nerd

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

              Protip: Rightclick on the row in the table to get a popup with the data for arrays and objects :)

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

                @d-healey said in loadUserPreset - strange behaviour...:

                Where are you getting number from though?

                I thought the number was the position of the selected combo box?

                Dan Korneff - Producer / Mixer / Audio Nerd

                d.healeyD 1 Reply Last reply Reply Quote 0
                • Christoph HartC
                  Christoph Hart
                  last edited by

                  @dustbro said in loadUserPreset - strange behaviour...:

                  I thought the number was the position of the selected combo box?

                  The combobox has a index starting with 1 because 0 marks "no selection".

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

                    @dustbro

                    I thought the number was the position of the selected combo box?

                    In this function the first time the word number appears is inside the switch. I think you want to replace number with value.

                    inline function onComboBox1Control(component, value)
                    {
                        switch (number)
                    	{
                    		case 1:
                    		Engine.loadUserPreset(list[0]);
                    		break;
                    
                    		case 2:
                    		Engine.loadUserPreset(list[1]);
                    		break;
                    	}
                    };
                    

                    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 said in loadUserPreset - strange behaviour...:

                      I think you want to replace number with value.

                      If I replace number with value, HISE crashes when I compile the script

                      Dan Korneff - Producer / Mixer / Audio Nerd

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

                        Even if I ditch the array
                        this = instant HISE crash:

                        inline function onComboBox1Control(component, value)
                        {
                            switch(value)
                        	{
                        		case 1:
                        		Engine.loadUserPreset("asdf/Bass/BassLeveler");
                        		break;
                        
                        		case 2:
                        		Engine.loadUserPreset("asdf/Drums/DrumPump");
                        		break;
                        	}
                        };
                        
                        Content.getComponent("ComboBox1").setControlCallback(onComboBox1Control);
                        

                        Dan Korneff - Producer / Mixer / Audio Nerd

                        LindonL d.healeyD 2 Replies Last reply Reply Quote 0
                        • LindonL
                          Lindon @Dan Korneff
                          last edited by

                          @dustbro yeah HISE crashes like a 0.1 app when I use loadUserPreset

                          HISE Development for hire.
                          www.channelrobot.com

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

                            @Lindon :( Using the Preset browser floating tile works as expected... but my GUI only has room for a simple combo box.
                            not sure what I'm doing wrong

                            Dan Korneff - Producer / Mixer / Audio Nerd

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

                              @dustbro yeah must be some bug with the load preset function. But value is definitely right since number doesn't exist

                              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 @Dan Korneff
                                last edited by

                                @dustbro As Dave pointed out to me, using:

                                storeAllControlsAsPreset("abc",false);

                                and
                                restoreAllControlsAsPreset("abc");

                                seems to be more reliable - try substituting those?

                                HISE Development for hire.
                                www.channelrobot.com

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

                                  @Lindon I'll give that a try.
                                  Is it required to use storeAllControlsAsPreset if the preset files already exist?

                                  Dan Korneff - Producer / Mixer / Audio Nerd

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

                                    @Christoph-Hart Is there an example of the CustomUserPreset tutorial that uses a combobox instead of the Viewport?

                                    Dan Korneff - Producer / Mixer / Audio Nerd

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

                                      @dustbro dont think so you could just give the Restore option a try...

                                      HISE Development for hire.
                                      www.channelrobot.com

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

                                        I'm having a go at making a custom preset browser, the first issue I've hit is storeAllControlsAsPreset() doesn't allow a folder structure with the file name, so all presets end up in the top level. Is there a known workaround for this?

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

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

                                        28

                                        Online

                                        1.7k

                                        Users

                                        11.7k

                                        Topics

                                        102.0k

                                        Posts