HISE Logo Forum
    • Categories
    • Register
    • Login

    Samplemaps Not Loading via Combobox

    Scheduled Pinned Locked Moved General Questions
    samplemapscomboboxsamples
    8 Posts 2 Posters 660 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.
    • trillbillyT
      trillbilly
      last edited by

      Hey Gang,

      So I've got 4 Samplers, each with a combobox that should allow the Sampler to load the selected sample.

      The combobox displays the name of the samples and allows you to click. However, the sample never changes in the Sampler.

      This does for all 4 samplers.

      What am I doing wrong?

      //SAMPLEMAP COMBOBOX
      const var Sampler0 = Synth.getChildSynth("Sampler0");
      const var Sampler1 = Synth.getChildSynth("Sampler1");
      const var Sampler2 = Synth.getChildSynth("Sampler2");
      const var Sampler3 = Synth.getChildSynth("Sampler3");
      
      //samplemaps
      const var sampleMaps = Sampler.getSampleMapList();
      
      //combobox note: cmb = name of combobox
      const var SamplemapsCmb0 = Content.getComponent("SamplemapsCmb0");
      SamplemapsCmb0.set("items", sampleMaps.join("\n"));
      
      const var SamplemapsCmb1 = Content.getComponent("SamplemapsCmb1");
      SamplemapsCmb1.set("items", sampleMaps.join("\n"));
      
      const var SamplemapsCmb2 = Content.getComponent("SamplemapsCmb2");
      SamplemapsCmb2.set("items", sampleMaps.join("\n"));
      
      const var SamplemapsCmb3 = Content.getComponent("SamplemapsCmb3");
      SamplemapsCmb3.set("items", sampleMaps.join("\n"));
      
      //Note: Sampler = name of Sampler
      inline function onSamplemapsCmb0Control(component, value)
      {
      	Sampler0.loadSampleMap(sampleMaps[value-1]);
      };
      
      Content.getComponent("SamplemapsCmb0").setControlCallback(onSamplemapsCmb0Control);
      
      inline function onSamplemapsCmb1Control(component, value)
      {
      	Sampler1.loadSampleMap(sampleMaps[value-1]);
      };
      
      Content.getComponent("SamplemapsCmb1").setControlCallback(onSamplemapsCmb1Control);
      
      inline function onSamplemapsCmb2Control(component, value)
      {
      	Sampler2.loadSampleMap(sampleMaps[value-1]);
      };
      
      Content.getComponent("SamplemapsCmb2").setControlCallback(onSamplemapsCmb2Control);
      
      inline function onSamplemapsCmb3Control(component, value)
      {
      	Sampler3.loadSampleMap(sampleMaps[value-1]);
      };
      
      Content.getComponent("SamplemapsCmb3").setControlCallback(onSamplemapsCmb3Control);
      
      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @trillbilly
        last edited by d.healey

        @trillbilly You can condense that a lot. You need to use the {PROJECT_FOLDER} wildcard I think.

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

        trillbillyT 1 Reply Last reply Reply Quote 0
        • trillbillyT
          trillbilly @d.healey
          last edited by

          @d-healey Ive never use this "wildcard" before. I have used this code on separate occasions with no error except for this time. Seems strange its only now.

          Yes, condensing will make things look much cleaner. Baby steps lol

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

            @trillbilly Oh I see the problem... childSynths don't have a loadSampleMap function. You need to get them as samplers.

            Here's the fixed condensed version:

            //SAMPLEMAP COMBOBOX
            const sampler = [];
            
            for (i = 0; i < 4; i++)
            {
            	sampler.push(Synth.getChildSynth("Sampler" + i));
            }
            
            //samplemaps
            const var sampleMaps = Sampler.getSampleMapList();
            
            //combobox note: cmb = name of combobox
            const cmbSampleMap = [];
            
            for (i = 0; i < 4; i++)
            {
            	cmbSampleMap.push(Content.getComponent("SamplemapsCmb" + i));
            	cmbSampleMap[i].set("items", sampleMaps.join("\n"));
            	cmbSampleMap[i].setControlCallback(oncmbSampleMapControl);
            }
            
            inline function cmbSampleMapControl(component, value)
            {
            	local index = cmbSampleMap.indexOf(component);
            
            	sampler[index].asSampler().loadSampleMap(sampleMaps[value - 1]);
            };
            

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

            trillbillyT 1 Reply Last reply Reply Quote 0
            • trillbillyT
              trillbilly @d.healey
              last edited by

              @d-healey This looks much better! Unfortunately it did not fix my issue. I still cannot switch samplemaps for some odd reason.

              I created an initial panel with all knobs, combobox, buttons, etc I would need for each sampler. Then, I duplicated this panel to create the total 4 samplers for UI. Could copying like this cause issues?

              Ive had trouble in the past with items going missing, UI being gone, etc that I was told could the result of moving things around different panels.

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

                @trillbilly

                Could copying like this cause issues?

                Did it work before the copying?

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

                trillbillyT 1 Reply Last reply Reply Quote 0
                • trillbillyT
                  trillbilly @d.healey
                  last edited by

                  @d-healey I only did the code after copying everything. I will try deleting and just manually adding elements to see if it works.

                  trillbillyT 1 Reply Last reply Reply Quote 0
                  • trillbillyT
                    trillbilly @trillbilly
                    last edited by

                    @trillbilly Luckily, I only had to delete Comboboxes and add again manually. All is well.

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

                    49

                    Online

                    1.7k

                    Users

                    11.7k

                    Topics

                    102.1k

                    Posts