HISE Logo Forum
    • Categories
    • Register
    • Login

    multi-column comboboxes -> HISE crashes constantly

    Scheduled Pinned Locked Moved General Questions
    16 Posts 3 Posters 343 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 @Oli Ullmann
      last edited by Lindon

      @Oli-Ullmann

      and why not do the replace once(on the sampleMapList) and then update all 4 with "items"

      const var sampleMaps = Sampler.getSampleMapList();
      
      for (map in sampleMaps)
      {
                             if(map.contains("Bass_"))
      			    map.replace("Bass_", "Bass::");
      			
      			if(map.contains("Bell_"))
      			   map.replace("Bell_","Bell::");
      			
      			if(map.contains("Brass_"))
      			   map.replace("Brass_","Brass::");
      			
      			if(map.contains("Drum_"))
      			   map.replace("Drum_","Drum::" );
      			
      			if(map.contains("FX_"))
      			   map.replace("FX_","FX::");
      			
      			if(map.contains("Git_"))
      			   map.replace("Git_","Git::");
      			
      			if(map.contains("Keys_"))
      			   map.replace("Keys_","Keys::");
      			
      			if(map.contains("Lead_"))
      			   map.replace("Lead_","Lead::");
      			
      			if(map.contains("Pad_"))
      			   map.replace("Pad_","Pad::");
      			
      			if(map.contains("Plug_"))
      			    map.replace("Plug_","Plug::" );
      			
      			if(map.contains("Seq_"))
      			   map..replace("Seq_","Seq::");
      			
      			if(map.contains("String_"))
      			    map.replace("String_","String::" );
      			
      			if(map.contains("Voice_"))
      			     map.replace("Voice_","Voice::");
      		}
      }
      Console.print(trace(sampleMaps));
      
      
      const var sampleCombos = [Content.getComponent("cmbSamples1"),
                                Content.getComponent("cmbSamples2"),
                                Content.getComponent("cmbSamples3"),
                                Content.getComponent("cmbSamples4")];
      
      for(c in sampleCombos)
      {
      		c.set("items", sampleMaps);
      }
      

      HISE Development for hire.
      www.channelrobot.com

      1 Reply Last reply Reply Quote 1
      • Oli UllmannO
        Oli Ullmann @d.healey
        last edited by

        @d-healey
        @Lindon

        Thank you both very much! :-)
        I will try out both suggestions.

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

          @Oli-Ullmann look at what you are getting back in the array sampleMaps after you've done the substitution, you are actually probably better off doing

          if(map.indexOf("Bass_") == 0)

          rather than

          if(map.contains("Bass_"))

          to make sure you are replacing one only occurrence

          Dave's approach is even better...

          HISE Development for hire.
          www.channelrobot.com

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

            @Lindon Thank you!

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

              @Oli-Ullmann this is interesting:

              const var sampleMaps = ["Bass_ONE","Bass_Two","Bass_three"];
              
              const cmbSamples = Content.getAllComponents("ComboBox");
              
              for (map in sampleMaps)
              {
              	reg firstSegment = map.substring(0, map.indexOf("_") + 1);
              	reg secondSegment = map.substring(map.indexOf("_") + 1, map.length);
              	Console.print(firstSegment.indexOf("_"));
              	firstSegment.replace("_", "::");
              	Console.print(firstSegment);
              	Console.print(secondSegment);
              }
              

              replace isnt working....for me at least..

              HISE Development for hire.
              www.channelrobot.com

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

                @Lindon Ok here you go.. the best of Dave and me ...

                
                const var sampleMaps = ["Bass_ONE","Bass_Two","Bass_three","Gtr_One"];
                
                const cmbSamples = Content.getAllComponents("ComboBox");
                
                for (map in sampleMaps)
                {
                	reg firstSegment = map.substring(0, map.indexOf("_") + 1);
                	reg secondSegment = map.substring(map.indexOf("_") + 1, map.length);
                	firstSegment = firstSegment.replace("_", "::");
                	map = firstSegment + secondSegment;
                }
                
                Console.print(trace(sampleMaps));
                
                populateComboBoxes();
                
                inline function populateComboBoxes()
                {
                	for(c in cmbSamples)
                	{
                		c.set("items", sampleMaps.join("\n"));
                	}	
                }
                

                HISE Development for hire.
                www.channelrobot.com

                Oli UllmannO d.healeyD 2 Replies Last reply Reply Quote 1
                • Oli UllmannO
                  Oli Ullmann @Lindon
                  last edited by

                  @Lindon Thank you very much! I'll try that out right away! :-)

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

                    @Lindon Wrap it in a function to avoid wasting reg variables.

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

                    LindonL 1 Reply Last reply Reply Quote 1
                    • LindonL
                      Lindon @d.healey
                      last edited by

                      @d-healey yes yes ....I know...Im lazy.

                      HISE Development for hire.
                      www.channelrobot.com

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

                        @Lindon so here is it all wrapped in one function call

                        
                        
                        const var sampleMaps = ["Bass_ONE","Bass_Two","Bass_three","Gtr_One"];
                        
                        const cmbSamples = Content.getAllComponents("ComboBox");
                        
                        populateComboBoxes();
                        
                        inline function populateComboBoxes()
                        {
                        	
                        	for (map in sampleMaps)
                        	{
                        		local firstSegment = map.substring(0, map.indexOf("_") + 1);
                        		local secondSegment = map.substring(map.indexOf("_") + 1, map.length);
                        		firstSegment = firstSegment.replace("_", "::");
                        		map = firstSegment + secondSegment;
                        	}
                        	
                        
                        	for(c in cmbSamples)
                        	{
                        		c.set("items", sampleMaps.join("\n"));
                        	}	
                        }
                        
                        

                        HISE Development for hire.
                        www.channelrobot.com

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

                          @Lindon
                          @d-healey
                          Guys, it looks like it's working now. You are brilliant! :-) The solution was apparently to replace the text already in the sampleMap array.

                          Thanks a lot! If you're ever in Germany, I'll buy you a beer! :-D

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

                          23

                          Online

                          1.8k

                          Users

                          12.1k

                          Topics

                          105.4k

                          Posts