HISE Logo Forum
    • Categories
    • Register
    • Login

    How To Select Different Group of SampleMaps ?

    Scheduled Pinned Locked Moved General Questions
    ahtv
    11 Posts 3 Posters 583 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.
    • A
      AHTV
      last edited by AHTV

      Hi all,
      I have 4 different samplemaps :
      4 samplemaps

      and 2 Combobox :
      alt text
      alt text

      I have read this document : Switch SampleMaps with a ComboBox but when I use the snippet, it shows all of my 4 samplemaps in each of the combobox.

      I read forum post here : samplemap / combobox script for 2 comboboxes but the psoter have delete the code, so I don't understand the context.

      What I want to ask is how each Combobox have its own set of Samplemaps (just 2 samplemaps, not all 4 samplemaps).
      And when user click the combobox entri, the right samplemap is loaded (right now, when I click the second entri, the samplemap didn't change).

      Please help n thanks !

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

        @AHTV there are only one set of sample maps - those in the SampleMaps folder in your project.

        The Combo boxes are just loading the required sample maps - you can have any number of sample maps referenced by your combo box - here you are using two in each box.

        What is the callback you are executing for the second combo box? - post it here:

        HISE Development for hire.
        www.channelrobot.com

        A 1 Reply Last reply Reply Quote 0
        • A
          AHTV @Lindon
          last edited by AHTV

          @Lindon said in How To Select Different Group of SampleMaps ?:

          @AHTV there are only one set of sample maps - those in the SampleMaps folder in your project.

          Thank for taking time to comment 🙏🏻
          Yes I know there's only 1 set of samplemaps but I would like each of dropdown box have it's own group of xml files (=each dropdown box have different xml set).

          I want to make a 2 group of dropdown, one Acoustic Piano Group and one Electric Piano Group. Each group consist of many sound, for example Ac Pno 1, Ac Pno 2, Ac Pno 3, Ac Pno 3 and user can layer it with the 2nd group of sound (Electric Piano) with many sounds too (Elec Pno 1, Elec Pno 2, Elec Pno 3 etc).

          What is the callback you are executing for the second combo box? - post it here:

          This is exaclty what I'm asking...What do I have to write on the callback so user can layer 2 group of sounds Ac Pno 2 & Elec Pno 5 for example, or Ac Pno 4 & Elec Pno 1. Right now, I don't have any code.

          Thanks

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

            have it's own group of xml files (=each dropdown box have different xml set).

            A combo box just contains a list of what ever values you want to put in it. It doesn't contain xml files.

            When you select a value in the combo box it will trigger a callback function (assuming you've assigned one to it).

            In the callback you can get the value (one indexed) that was selected.

            You can use that value as the index to an array that contains the references for your sample maps.

            You could have two arrays if you wanted, one for each combo box, or you could just offset the index used in the second combo's callback.

            If what I've said doesn't make sense you should start with 4 buttons instead of combo boxes so you can have a better understanding of the concepts.

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

            A 1 Reply Last reply Reply Quote 0
            • A
              AHTV @d.healey
              last edited by AHTV

              @d-healey said in How To Select Different Group of SampleMaps ?:

              have it's own group of xml files (=each dropdown box have different xml set).

              A combo box just contains a list of what ever values you want to put in it. It doesn't contain xml files.

              What I mean is in HISE example here : https://docs.hise.audio/tutorials/recipes/ui/general.html (under "Switch SampleMaps with a ComboBox"), we can switch to different SampleMaps by choose an entri in the dropdown box.

              But, it list all the samplemaps that I have in the Samplemaps folder (Ac Pno & Elec Pno).
              What I want is that dropdown box 1 only list some samplemaps (Ac Piano only) and dropdown box 2 have different samplemaps (Elec Pno only).

              Why I insist on using dropdown box, because of the desain of the GUI is more cleaner. If I have 30 preset/samplemaps, using 30 buttons is not so intuitif, but using Dropdown box, I only need 2 box (each have 15 presets).

              Thanks

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

                @AHTV

                The problem is you are using that example without understanding it. You previously said you have no code, but that example contains code, so you need to learn what that code does to be in control of it.

                Why I insist on using dropdown box

                I'm recommending as a learning tool that you start simple, make a new project, put 4 buttons on the UI, and get a feel for how to create callbacks, and load sample maps. Then add a combo box and learn how to do it with a combo box, then go for two combo boxes, once you have it working in your test project you can try and implement it in your main project.

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

                A 1 Reply Last reply Reply Quote 0
                • A
                  AHTV @d.healey
                  last edited by

                  @d-healey Ok sorry I was wrong. The callback is present :

                  // Create a Script Reference for the Sampler Module
                  const var s = Synth.getSampler("Sampler")
                  
                  // get the list off all SampleMaps that are saved in the SampleMaps project folder
                  const var list = Sampler.getSampleMapList();
                  
                  // Get the Combobox Widget and add all SampleMaps.xmls to the `items` list 
                  Content.getComponent("SampleMapSelector").set("items", list.join("\n"));
                  
                  inline function onSampleMapSelectorControl(component, value)
                  {
                      if (value)
                          s.loadSampleMap(component.getItemText());
                  }
                  
                  Content.getComponent("SampleMapSelector").setControlCallback(onSampleMapSelectorControl);
                  

                  The dropdown box list all of my samplemaps. How can I modify the code so I can have only some samplemap present in a dropbox box, not listing all samplemaps in the samplemaps folder?

                  Thanks

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

                    @AHTV

                    How can I modify the code so I can have only some samplemap present in a dropbox box, not listing all samplemaps in the samplemaps folder?

                    You'll need to loop through the list and use the string commands (like substring, indexOf, and contains) to split it up into two lists based on your parameters. Then you can use those two lists to populate your combo boxes.

                    Keep in mind that as soon as there are two combo boxes you are adding complexity because it is not simply a case of matching the value of one combo box to the xml references in an array. Which is what is happening in the example.

                    You have to do one of the things I mentioned before. Using the value to get a reference to the selected sample map. Either using two arrays or using one array and offsetting the index, I'd probably go for the second option.

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

                    A 1 Reply Last reply Reply Quote 0
                    • A
                      AHTV @d.healey
                      last edited by

                      @d-healey said in How To Select Different Group of SampleMaps ?:

                      @AHTV

                      How can I modify the code so I can have only some samplemap present in a dropbox box, not listing all samplemaps in the samplemaps folder?

                      You'll need to loop through the list and use the string commands (like substring, indexOf, and contains) to split it up into two lists based on your parameters. Then you can use those two lists to populate your combo boxes.

                      Keep in mind that as soon as there are two combo boxes you are adding complexity because it is not simply a case of matching the value of one combo box to the xml references in an array. Which is what is happening in the example.

                      You have to do one of the things I mentioned before. Using the value to get a reference to the selected sample map. Either using two arrays or using one array and offsetting the index, I'd probably go for the second option.

                      Ok thanks, I will try this, thanks a lot !

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

                        @AHTV Post some snippets of your progress when you need help

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

                        A 1 Reply Last reply Reply Quote 0
                        • A
                          AHTV @d.healey
                          last edited by

                          @d-healey said in How To Select Different Group of SampleMaps ?:

                          @AHTV Post some snippets of your progress when you need help

                          I will !
                          You are always been helpful, thanks !

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

                          16

                          Online

                          1.7k

                          Users

                          11.8k

                          Topics

                          102.4k

                          Posts