HISE Logo Forum
    • Categories
    • Register
    • Login

    Sample map Expansion Tutorial

    Scheduled Pinned Locked Moved General Questions
    43 Posts 3 Posters 1.8k 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.
    • B
      BWSounds @DanH
      last edited by

      @danh
      That would be great!
      And no factory presest, I was planning on having an expansion titled "FACTORY"
      also Im using the preset browser to switch between expansions.

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

        @bwsounds said in Sample map Expansion Tutorial:

        no iterable type keeps popping up, so I know im way off. Did a search on it but nothing came up.

        This video was made for you

        And you should read this - https://docs.hise.audio/scripting/scripting-in-hise/hise-script-coding-standards.html

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

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

          @bwsounds here it is, essentially it's all dealt with with the 'expHandler.setExpansionCallback' function. 'SAMPLEBOX' is my combo box which lists the available sample maps for the user to browse, and the 'sampleMapsed' array is the list of expansion sample maps (so I guess you can ignore the 'sampleMaps' array). It also removes all the Expansion text so you just get the name of your sample map in the combo box.

          const var expHandler = Engine.createExpansionHandler();
          
          const var expansions = expHandler.getExpansionList();
          
          expHandler.setAllowedExpansionTypes([expHandler.FileBased, 
                                               expHandler.Intermediate, 
                                               expHandler.Encrypted]);
                                               
          const var expansionNames = [];
          /// Push 'FACTORY" into the available expansion packs list so users can navigate back to factory presets
          
          expansionNames.push("FACTORY");
          
          for(e in expHandler.getExpansionList())
              expansionNames.push(e.getProperties().Name);
              
          const var ExpansionSelector = Content.getComponent("ExpansionSelector");
          ExpansionSelector.set("items", expansionNames.join("\n"));
          
          // Implement the expansion switch
          
          inline function onExpansionSelectorControl(component, value)
          {
          	local expansionToLoad = component.getItemText();
          	
          	// We want the first item to reset the current expansion
          	// so we need to change it to an empty string
          	if(expansionToLoad == expansionNames[0])
                  expansionToLoad = "";
              
          	expHandler.setCurrentExpansion(expansionToLoad);
          };
          
          Content.getComponent("ExpansionSelector").setControlCallback(onExpansionSelectorControl);
          
          var sampleMaps = Sampler.getSampleMapList();
          var sampleMapsed = Sampler.getSampleMapList();
          
          inline function newcombobox(newExpansion)
          {
          
                 if(isDefined(newExpansion))
          
              {
                  local cx = expHandler.getCurrentExpansion();
                  sampleMaps = cx.getSampleMapList();
                  sampleMapsed = cx.getSampleMapList();
                  local expansionProps = cx.getProperties();
                  local expName = expansionProps.Name;
          
                  for (i = 0; i < sampleMapsed.length; i++)
                  {
                  sampleMapsed[i] = sampleMapsed[i].replace("{EXP::");
                  sampleMapsed[i] = sampleMapsed[i].replace("}");
                  sampleMapsed[i] = sampleMapsed[i].replace(expName);
          
                  }
          
                  SAMPLEBOX.set("items", "");
                  SAMPLEBOX.set("items", sampleMapsed.join("\n"));
                 
              }
              else
              {
                  sampleMaps = Sampler.getSampleMapList();
                  SAMPLEBOX.set("items", "");
                  SAMPLEBOX.set("items", mySampleMapNames.join("\n"));
          
              }
          
          }
          
          expHandler.setExpansionCallback(newcombobox);
          
          newcombobox(undefined);
          

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

          B 2 Replies Last reply Reply Quote 2
          • B
            BWSounds @DanH
            last edited by BWSounds

            @danh
            Thank you!
            But im still having the same issue... when I do this

                 //   sampleMapsed[i] = sampleMapsed[i].replace("{EXP::");
                 //   sampleMapsed[i] = sampleMapsed[i].replace("}");
                 //   sampleMapsed[i] = sampleMapsed[i].replace(expName);
            
            

            the samplemaps load up, but if I remove the

            //
            

            the samplemaps load up.... i'll dig around and mess with this a bit, maybe im missing something... thank you.

            1 Reply Last reply Reply Quote 0
            • B
              BWSounds @DanH
              last edited by

              @danh
              ok, after a few days I figured it mostly out, thank you.
              one issue still remains... once I switch back to "factory" my combobox doesn't populate those samplemaps... What could cause that?

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

                @bwsounds said in Sample map Expansion Tutorial:

                What could cause that?

                Show us some code

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

                B 1 Reply Last reply Reply Quote 0
                • B
                  BWSounds @d.healey
                  last edited by

                  @d-healey

                  list1 is my combobox

                  // // // E X P A N S I O N // // //
                  const var expHandler = Engine.createExpansionHandler();
                  const var expansions = expHandler.getExpansionList();
                  
                  expHandler.setAllowedExpansionTypes([expHandler.FileBased, 
                                                       expHandler.Intermediate, 
                                                       expHandler.Encrypted]);
                  const var expansionNames = [];
                  expansionNames.push("FACTORY");
                  
                  for(e in expHandler.getExpansionList())
                      expansionNames.push(e.getProperties().Name);
                  
                  const var ExpansionSelector = Content.getComponent("ExpansionSelector");
                   
                  
                  
                   inline function onExpansionSelectorControl(component, value)
                   {
                    	local expansionToLoad = component.getItemText();
                   	
                   	// We want the first item to reset the current expansion
                   	// so we need to change it to an empty string
                   	if(expansionToLoad == expansionNames[0])
                           expansionToLoad = "";
                       
                    	expHandler.setCurrentExpansion(expansionToLoad);
                   };
                   
                   Content.getComponent("ExpansionSelector").setControlCallback(onExpansionSelectorControl);
                   
                  const   Sampler1 = Synth.getSampler("Sampler1");
                   
                  const list1 = Content.getComponent("list1");
                  list1.setControlCallback(onlist1Control);
                  
                  
                  const var namesExp = [];
                  
                  
                  var sampleMaps   = Sampler.getSampleMapList();
                  var sampleMapsed = Sampler.getSampleMapList();
                  
                  inline function newcombobox(newExpansion)
                  {
                  
                         if(isDefined(newExpansion))
                  
                      {
                          local cx = expHandler.getCurrentExpansion();
                          sampleMaps = cx.getSampleMapList();
                          sampleMapsed = cx.getSampleMapList();
                          local expansionProps = cx.getProperties();
                          local expName = expansionProps.Name;
                   
                  
                          list1.set("items", "");
                          list1.set("items", sampleMapsed.join("\n"));
                        
                      }
                      else
                      {
                  	
                         sampleMaps = Sampler.getSampleMapList();
                         list1.set("items", "");
                   
                      }
                  }
                  
                  expHandler.setExpansionCallback(newcombobox);
                  
                  newcombobox(undefined);
                  
                   
                  
                  
                  
                  
                   inline function onlist1Control(component, value)
                   {
                   	if (value > 0)
                   	{
                   		local sampleMap = component.getItemText();
                   
                   		if (sampleMap != "")
                   		Sampler1.loadSampleMap(sampleMap);		
                   			
                   	}		
                   }
                   
                   
                   
                  
                   
                   
                    inline function onlist2Control(component, value)
                    {
                    	if (value > 0)
                    	{
                    		local sampleMap = component.getItemText();
                   
                    		if (sampleMap != "")
                    		Sampler2.loadSampleMap(sampleMap);		
                   			
                    	}		
                    }
                   
                   
                  
                  
                  
                  ExpansionSelector.set("items", expansionNames.join("\n"));
                  list1.set("items", sampleMaps.join("\n"));
                  list2.set("items", sampleMaps.join("\n"));
                  
                  
                  d.healeyD 1 Reply Last reply Reply Quote 0
                  • d.healeyD
                    d.healey @BWSounds
                    last edited by

                    @bwsounds I don't think the expansionCallback is triggered when you set the currentExpansion to "". You should test it to see if that is the case.

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

                    B 1 Reply Last reply Reply Quote 0
                    • B
                      BWSounds @d.healey
                      last edited by

                      @d-healey
                      humm, still having the same issue.

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

                        @bwsounds Need to see some code to know what you're doing. Does the expansion callback trigger?

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

                        B d.healeyD 2 Replies Last reply Reply Quote 0
                        • B
                          BWSounds @d.healey
                          last edited by

                          @d-healey
                          I removed the "currentExpansion to" but The factory samplemaps still wont populate in the combobox after previously selecting an expansion.

                          // // // E X P A N S I O N // // //
                          const var expHandler = Engine.createExpansionHandler();
                          const var expansions = expHandler.getExpansionList();
                          
                          expHandler.setAllowedExpansionTypes([expHandler.FileBased, 
                                                              expHandler.Intermediate, 
                                                              expHandler.Encrypted]);
                          const var expansionNames = [];
                          expansionNames.push("FACTORY");
                          
                          for(e in expHandler.getExpansionList())
                             expansionNames.push(e.getProperties().Name);
                          
                          
                          
                          const   Sampler1 = Synth.getSampler("Sampler1");
                          
                          const list1 = Content.getComponent("list1");
                          list1.setControlCallback(onlist1Control);
                          
                          
                          const var namesExp = [];
                          
                          
                          var sampleMaps   = Sampler.getSampleMapList();
                          var sampleMapsed = Sampler.getSampleMapList();
                          
                          inline function newcombobox(newExpansion)
                          {
                          
                                if(isDefined(newExpansion))
                          
                             {
                                 local cx = expHandler.getCurrentExpansion();
                                 sampleMaps = cx.getSampleMapList();
                                 sampleMapsed = cx.getSampleMapList();
                                 local expansionProps = cx.getProperties();
                                 local expName = expansionProps.Name;
                          
                          
                                 list1.set("items", "");
                                 list1.set("items", sampleMapsed.join("\n"));
                               
                             }
                             else
                             {
                             
                                sampleMaps = Sampler.getSampleMapList();
                                list1.set("items", "");
                          
                             }
                          }
                          
                          expHandler.setExpansionCallback(newcombobox);
                          
                          newcombobox(undefined);
                          
                          
                          
                          
                          
                          
                          inline function onlist1Control(component, value)
                          {
                          	if (value > 0)
                          	{
                          		local sampleMap = component.getItemText();
                          
                          		if (sampleMap != "")
                          		Sampler1.loadSampleMap(sampleMap);		
                          			
                          	}		
                          }
                          
                          
                          list1.set("items", sampleMaps.join("\n"));
                          list2.set("items", sampleMaps.join("\n"));
                          
                          DanHD 1 Reply Last reply Reply Quote 0
                          • d.healeyD
                            d.healey @d.healey
                            last edited by

                            Does the expansion callback trigger when you deselect the expansion and return to the "factory" setup?

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

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

                              @bwsounds You're selecting expansions / factory etc through the preset browser, right?

                              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 He has a combobox

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

                                1 Reply Last reply Reply Quote 0
                                • B
                                  BWSounds @d.healey
                                  last edited by

                                  @d-healey said in Sample map Expansion Tutorial:

                                  Does the expansion callback trigger when you deselect the expansion and return to the "factory" setup?

                                  yep

                                  @danh said in Sample map Expansion Tutorial:

                                  You're selecting expansions / factory etc through the preset browser, right?

                                  originally yes, but i switched to a combobox as I thought it would help me with this issue.

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

                                    @bwsounds In your expansion callback you are checking if newExpansion is defined, when you revert to the factory setup newExpansion will be "" which is also defined, so you won't hit the else clause.

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

                                    B 1 Reply Last reply Reply Quote 1
                                    • B
                                      BWSounds @d.healey
                                      last edited by

                                      @d-healey
                                      ahh makes since.

                                      B 1 Reply Last reply Reply Quote 0
                                      • B
                                        BWSounds @BWSounds
                                        last edited by

                                        @d-healey @DanH
                                        ok thank you guys for your help, last question.

                                        Does if make a difference whether I use a expansion install script to install the expansions or just add a button to the interface that opens up a browser window to the expansion folder and let the user drop the expansion in there?

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

                                          @bwsounds said in Sample map Expansion Tutorial:

                                          last question.

                                          I like your optimism ;)

                                          @bwsounds said in Sample map Expansion Tutorial:

                                          Does if make a difference whether I use a expansion install script to install the expansions

                                          Are you referring to the built in expansion installer function for .hr files?

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

                                          B 1 Reply Last reply Reply Quote 0
                                          • B
                                            BWSounds @d.healey
                                            last edited by

                                            @d-healey said in Sample map Expansion Tutorial:

                                            I like your optimism

                                            haha 🤷

                                            @d-healey said in Sample map Expansion Tutorial:

                                            Are you referring to the built in expansion installer function for .hr files?

                                            yes, do I NEED to do that for expansions?

                                            DanHD d.healeyD 2 Replies Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            34

                                            Online

                                            1.8k

                                            Users

                                            12.0k

                                            Topics

                                            104.1k

                                            Posts