HISE Logo Forum
    • Categories
    • Register
    • Login

    How to reliably save samplemaps in preset? (Expansions)

    Scheduled Pinned Locked Moved Solved General Questions
    11 Posts 5 Posters 475 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.
    • bendursoB
      bendurso @Straticah
      last edited by

      @Straticah Oh, I did something similar a few days ago.

      I asked ChatGPT to create a script to transform all the numeric values ​​into strings. To do this, I gave it the list of sample maps for each expansion (using Expansion.getSampleMapList), letting it know that the combo box has index 1. It worked like a charm.

      I can't find the script.. but in my case it was a little different because I used a hidden label to store the names of the samplemaps. Then of course it's required to update all the expansions.

      StraticahS 1 Reply Last reply Reply Quote 1
      • StraticahS
        Straticah @bendurso
        last edited by Straticah

        @bendurso Yes that makes a lot of sense - whats the way you used to save strings to a preset?

        Edit: oh i see you used a hidden label

        creating user interfaces: www.vst-design.com
        founder @prototype.audio https://www.prototype.audio/

        StraticahS bendursoB 2 Replies Last reply Reply Quote 0
        • StraticahS
          Straticah @Straticah
          last edited by

          @Christoph-Hart sry to bother - is there a less hacky way?
          @bendurso I would have never thought about that good idea.

          creating user interfaces: www.vst-design.com
          founder @prototype.audio https://www.prototype.audio/

          ChazroxC 1 Reply Last reply Reply Quote 0
          • bendursoB
            bendurso @Straticah
            last edited by bendurso

            @Straticah Oh, I just reread your original question—you were actually asking how to do it.

            Yes, I used a label to save the samplemap name. The combobox still relies on the samplemaps array (with saveInPreset disabled), but I use the label to store the string name. Then I restore the combobox by matching the samplemap name.

            edit: actually, David told me to do this a couple a months ago lol.

            Christoph HartC 1 Reply Last reply Reply Quote 1
            • StraticahS Straticah has marked this topic as solved
            • Christoph HartC
              Christoph Hart @bendurso
              last edited by Christoph Hart

              Multiple options:

              1. Use a hidden panel with saveInPreset=true and store all loaded sample map in a JSON array, then call Panel.setValue() with this. In its control callback, restore all comboboxes / load the sample maps. The comboboxes must not be savedInPreset for this to work.
              2. Use the custom user preset system and define your data model as you wish.

              Number 2 is probably overkill, so I would go with option 1.

              1 Reply Last reply Reply Quote 3
              • ChazroxC
                Chazrox @Straticah
                last edited by

                @Straticah Have you tried calling presets by its name? I do that because if I add new presets AND sort in alphabetical order, the index obviously changes and will break my presets.

                StraticahS 1 Reply Last reply Reply Quote 0
                • StraticahS
                  Straticah @Chazrox
                  last edited by Straticah

                  @Chazrox The issue is currently only with samplemaps not with loading presets.
                  I am now doing what @Christoph-Hart and @bendurso suggested which is saving the samplemap via a label which adds it to the preset data.

                  <Control type="ScriptLabel" id="presetpath_01" value="{EXP::Hardware Lab}Juno Elements"/>
                  <Control type="ScriptLabel" id="presetpath_02" value="{EXP::Hardware Lab}Movement-120"/>
                  

                  Not as hacky for HISE as i thought :)

                  creating user interfaces: www.vst-design.com
                  founder @prototype.audio https://www.prototype.audio/

                  Oli UllmannO 1 Reply Last reply Reply Quote 1
                  • Oli UllmannO
                    Oli Ullmann @Straticah
                    last edited by Oli Ullmann

                    @Straticah
                    Why don't you do it this way? It works in my project.

                    First, get all the sampleMaps into the project:

                    const sampleMaps = Sampler.getSampleMapList();
                    

                    Then fill your combo box with all the maps.

                    And the combo box callback looks something like this:

                    for(m in sampleMaps)
                    {
                        if(m.contains(combobox.getItemText()))
                            sampler.asSampler().loadSampleMap(m);
                    }
                    

                    The combo box must, of course, be saveInPreset.

                    I think that should still work even if you add new sample maps to the existing plug-in. But I still need to test that.

                    You also could do:

                    if(m == combobox.getItemText())
                    
                    Christoph HartC 1 Reply Last reply Reply Quote 0
                    • Christoph HartC
                      Christoph Hart @Oli Ullmann
                      last edited by

                      @Oli-Ullmann said in How to reliably save samplemaps in preset? (Expansions):

                      The combo box must, of course, be saveInPreset.

                      comboboxes store their value as index, so if the sample map items change because you load in a different expansion, it will not load the correct one.

                      Oli UllmannO 1 Reply Last reply Reply Quote 1
                      • Oli UllmannO
                        Oli Ullmann @Christoph Hart
                        last edited by

                        @Christoph-Hart
                        Ah, I see. Thanks for explaining!

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

                        22

                        Online

                        1.9k

                        Users

                        12.5k

                        Topics

                        108.8k

                        Posts