HISE Logo Forum
    • Categories
    • Register
    • Login

    2 Sets of Sample Maps?

    Scheduled Pinned Locked Moved General Questions
    17 Posts 3 Posters 623 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.
    • LindonL
      Lindon @DanH
      last edited by

      @DanH - get your list of sample and divide them out into 2 arrays - load each combo box with one of the arrays...

      HISE Development for hire.
      www.channelrobot.com

      DanHD 2 Replies Last reply Reply Quote 0
      • DanHD
        DanH @Lindon
        last edited by

        @Lindon :love-you_gesture:

        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
        https://dhplugins.com/ | https://dcbreaks.com/
        London, UK

        1 Reply Last reply Reply Quote 0
        • DanHD
          DanH @Lindon
          last edited by

          @Lindon I'm definitely missing a piece of the puzzle here 😆

          Feels like I need a separate .getSampleMapList()

          const var sampleMaps = Sampler.getSampleMapList();
          const var SAMPLEBOX = Content.getComponent("SAMPLEBOX");
          const var SAMPLEBOX1 = Content.getComponent("SAMPLEBOX1");
          const var mySampleMapNames = ["KICK 01", "KICK 02", "KICK 03", "KICK 04", "KICK 05"];
          const var mySampleMapNames2 = ["SNARES", "KICKS"];
          
          SAMPLEBOX.set("items", mySampleMapNames.join("\n"));
          SAMPLEBOX1.set("items", mySampleMapNames2.join("\n"));
          
          inline function onSAMPLEBOXControl(component, value)
          {
            Sampler1.asSampler().loadSampleMap(sampleMaps[value-1]);
          };
          
          Content.getComponent("SAMPLEBOX").setControlCallback(onSAMPLEBOXControl);
          
          inline function onSAMPLEBOX1Control(component, value)
          {
            Sampler2.asSampler().loadSampleMap(sampleMaps[value-1]);
          };
          
          Content.getComponent("SAMPLEBOX1").setControlCallback(onSAMPLEBOX1Control);
          

          DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
          https://dhplugins.com/ | https://dcbreaks.com/
          London, UK

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

            Forget about the .getSampleMapsList() function for a minute. You're over complicating it. You have an array that you want to split in two.

            So, make an array with 10 values

            const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

            Now split it into two arrays using a loop

            const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
            
            const a1 = [];
            const a2 = [];
            
            for (i = 0; i < 5; i++)
            {
                a1[i] = a[i];
                a2[i] = a[i + 5];
            }
            
            Console.print(trace(a1));
            Console.print(trace(a2));
            

            Now adapt this to suit your use case.

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

            DanHD 1 Reply Last reply Reply Quote 0
            • DanHD
              DanH @d.healey
              last edited by

              @d-healey Ok I'm lost now!

              Where do I put the new arrays?

              DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
              https://dhplugins.com/ | https://dcbreaks.com/
              London, UK

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

                @DanH Wherever you want them... or you can just populate the combobox lists directly from the initial array, one item at a time, in the loop.

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

                DanHD 1 Reply Last reply Reply Quote 0
                • DanHD
                  DanH @d.healey
                  last edited by

                  @d-healey I don't understand - the arrays aren't related to the sample maps in any way - I was expecting to do something like below but the function doesn't work like that...

                  inline function onSAMPLEBOXControl(component, value)
                  {
                    Sampler1.asSampler().loadSampleMap(sampleMaps[a1]);
                  };
                  
                  Content.getComponent("SAMPLEBOX").setControlCallback(onSAMPLEBOXControl);
                  

                  DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                  https://dhplugins.com/ | https://dcbreaks.com/
                  London, UK

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

                    @DanH Show me how you're doing it currently with a single array

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

                    DanHD 1 Reply Last reply Reply Quote 0
                    • DanHD
                      DanH @d.healey
                      last edited by

                      @d-healey

                      inline function onSAMPLEBOX1Control(component, value)
                      {
                        TRANSIENT.asSampler().loadSampleMap(sampleMaps[value-1]);
                      };
                      
                      Content.getComponent("SAMPLEBOX1").setControlCallback(onSAMPLEBOX1Control);
                      

                      DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                      https://dhplugins.com/ | https://dcbreaks.com/
                      London, UK

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

                        Right, your array is called sampleMaps and this contains all of the sample maps.

                        You want to split this into two arrays, one for each combobox (there are other ways but this will be the simplest). Your code will look exactly the same except the name of the array will be different in each combobox's callback.

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

                          @DanH said in 2 Sets of Sample Maps?:

                          @d-healey

                          inline function onSAMPLEBOX1Control(component, value)
                          {
                            TRANSIENT.asSampler().loadSampleMap(sampleMaps[value-1]);
                          };
                          
                          Content.getComponent("SAMPLEBOX1").setControlCallback(onSAMPLEBOX1Control);
                          

                          OK so where are you loading up "sampleMaps" ??

                          -- and maybe think about naming things better...

                          const var mySampleMaps = ["mapName1","mapName1","mapName2","mapName3","mapName4","mapName5","mapName6"];
                          
                          inline function onSAMPLEBOX1Control(component, value)
                          {
                            TRANSIENT.asSampler().loadSampleMap(mySampleMaps[value-1]);
                          };
                          
                          Content.getComponent("SAMPLEBOX1").setControlCallback(onSAMPLEBOX1Control);
                          

                          can you work i tout from there?

                          HISE Development for hire.
                          www.channelrobot.com

                          DanHD 1 Reply Last reply Reply Quote 0
                          • DanHD
                            DanH @Lindon
                            last edited by

                            @Lindon @d-healey I think I've got confused with the .getSampleMapsList() function and I've been thinking that's the only way to get the samplemaps into the sampler. I see now it's more of a convenient way to get the whole list in one go.

                            I think I've got it now, thanks both :thumbs_up:

                            DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                            https://dhplugins.com/ | https://dcbreaks.com/
                            London, UK

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

                              @DanH That function just provides an array of sample maps names. If you know the names aren't going to change you can write it out manually like Lindon demonstrated.

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

                              DanHD 1 Reply Last reply Reply Quote 0
                              • DanHD
                                DanH @d.healey
                                last edited by DanH

                                @d-healey Thanks, I wrote out all 320 in my last project into one array (in order to change the names) :face_with_tears_of_joy:

                                So to clarify something - when I had a list of sample maps and I deleted say one, the whole list after that one obviously shifted one map - and my presets which used the maps after that one were loading the wrong maps (i.e they loaded the map 1 below what I had saved).

                                Am I going about this the wrong way? Should the sampler be able to find the correct sample map no matter how they are arranged in the samplemaps folder?

                                DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                https://dhplugins.com/ | https://dcbreaks.com/
                                London, UK

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

                                  @DanH

                                  Should the sampler be able to find the correct sample map no matter how they are arranged in the samplemaps folder?

                                  The sampler doesn't do any finding. All it does is load the sample map you tell it to, it's your job to implement the mechanism for that.

                                  If you are loading sample maps from a UI control and that UI control is saved in the preset, then when you delete or add a sample map it could definitely screw things up and I think there's not much you can do about it.

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

                                  DanHD 1 Reply Last reply Reply Quote 0
                                  • DanHD
                                    DanH @d.healey
                                    last edited by

                                    @d-healey Ok I think my assumption was right then, thanks.

                                    DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                    https://dhplugins.com/ | https://dcbreaks.com/
                                    London, UK

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

                                    15

                                    Online

                                    1.8k

                                    Users

                                    12.0k

                                    Topics

                                    104.2k

                                    Posts