Forum
    • Categories
    • Register
    • Login

    Change Sample Map via ComboBox

    Scheduled Pinned Locked Moved Scripting
    14 Posts 4 Posters 1.5k 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.
    • P
      pgaudioworks @David Healey
      last edited by

      @d-healey thank you. Are you referring to getSampleMapList? I have this, bit it's giving me an error:

      const var Sampler1 = Synth.getChildSynth("Sampler1");
      
      Console.Print(Sampler1.getSampleMapList());
      

      Error:

      Interface:! Line 5, column 14: Function / constant not found: Console.Print {SW50ZXJmYWNlfG9uSW5pdCgpfDEwN3w1fDE0}
      Master Chain:! Line 5, column 14: Function / constant not found: Console.Print {SW50ZXJmYWNlfG9uSW5pdCgpfDEwN3w1fDE0}
      
      David HealeyD 1 Reply Last reply Reply Quote 0
      • David HealeyD
        David Healey @pgaudioworks
        last edited by

        @pgaudioworks getSampleMapList() is a function of the Sampler class, not childSynth

        Try using Synth.getSampler("Sampler1");

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        P 1 Reply Last reply Reply Quote 0
        • P
          pgaudioworks @David Healey
          last edited by

          @d-healey I updated it and I'm still getting the same error.

          const var Sampler1 = Synth.getSampler("Sampler1");
          
          Console.Print(Sampler1.getSampleMapList());
          

          Error:

          Interface:! Line 5, column 14: Function / constant not found: Console.Print {SW50ZXJmYWNlfG9uSW5pdCgpfDEwNHw1fDE0}
          Master Chain:! Line 5, column 14: Function / constant not found: Console.Print {SW50ZXJmYWNlfG9uSW5pdCgpfDEwNHw1fDE0}
          
          
          David HealeyD 1 Reply Last reply Reply Quote 0
          • David HealeyD
            David Healey @pgaudioworks
            last edited by David Healey

            @pgaudioworks The error message is telling you it can't find the function you are calling on line 5. You are calling two functions on that line, try eliminating one of them and see if the error remains.

            I just noticed, the error message tells you which function.

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - Public HISE tutorials
            My Patreon - HISE tutorials

            P 1 Reply Last reply Reply Quote 0
            • P
              pgaudioworks @David Healey
              last edited by

              @d-healey really grateful for your help. I think I'm confused that I'm calling two functions. How does the console know what to print if I don't include both Console.Print and getSampleMapList?

              David HealeyD 1 Reply Last reply Reply Quote 0
              • David HealeyD
                David Healey @pgaudioworks
                last edited by

                @pgaudioworks Console.Print is not a function ;)

                Free HISE Bootcamp Full Course for beginners.
                YouTube Channel - Public HISE tutorials
                My Patreon - HISE tutorials

                P 1 Reply Last reply Reply Quote 0
                • P
                  pgaudioworks @David Healey
                  last edited by

                  @d-healey I shouldn't have had the p capitalized, got it. I've now gotten this far:

                  const var Sampler1 = Synth.getSampler("Sampler1");
                  
                  const var SampleSelection = Content.getComponent("SampleSelection");
                  
                  
                  
                  Console.print(Sampler1.getSampleMapList()); 
                  
                  Console.print(SampleSelection.getValue()-1);
                  
                  
                  inline function onSampleSelectionControl(component, value)
                  {
                  	Sampler1.loadSampleMap(SampleSelection.getValue()-1);
                  };
                  
                  Content.getComponent("SampleSelection").setControlCallback(onSampleSelectionControl);
                  

                  The console is returning the right values, but the sampler isn't changing when I update the combo box. Am I any closer?

                  David HealeyD 1 Reply Last reply Reply Quote 0
                  • David HealeyD
                    David Healey @pgaudioworks
                    last edited by

                    @pgaudioworks Is SampleSelection.getValue()-1 the name of your sample map?

                    Free HISE Bootcamp Full Course for beginners.
                    YouTube Channel - Public HISE tutorials
                    My Patreon - HISE tutorials

                    P 1 Reply Last reply Reply Quote 0
                    • P
                      pgaudioworks @David Healey
                      last edited by

                      @d-healey it's the name of the combo box.

                      David HealeyD 1 Reply Last reply Reply Quote 0
                      • David HealeyD
                        David Healey @pgaudioworks
                        last edited by

                        @pgaudioworks

                        Sampler1.loadSampleMap(SampleSelection.getValue()-1);

                        loadSampleMap expects the name of a sample map.

                        Free HISE Bootcamp Full Course for beginners.
                        YouTube Channel - Public HISE tutorials
                        My Patreon - HISE tutorials

                        1 Reply Last reply Reply Quote 0
                        • M
                          Mighty23
                          last edited by

                          @pgaudioworks try someting like this, where "cmbSampleMap" is my Combo Box

                          // My Sample Map on Combobox
                          const var sampleMaps = Sampler.getSampleMapList(); // get a Sample Map List
                          const var cmbSampleMap = Content.getComponent("cmbSampleMap"); //combo box
                          const var Sampler1 = Synth.getChildSynth("Sampler1"); // Sampler Reference
                          
                          // populate combo box with sample maps
                          cmbSampleMap.set("items", sampleMaps.join("\n"));
                          
                          inline function oncmbSampleMapControl(component, value)
                          {
                          	//Console.print(value);
                          	Sampler1.asSampler().loadSampleMap(sampleMaps[value-1]);
                          };
                          
                          Content.getComponent("cmbSampleMap").setControlCallback(oncmbSampleMapControl);
                          

                          Free Party, Free Tekno & Free Software too

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

                          40

                          Online

                          2.1k

                          Users

                          13.0k

                          Topics

                          113.0k

                          Posts