HISE Logo Forum
    • Categories
    • Register
    • Login

    Sampler.setSoundPropertyForSelection(); seems to have a bug.

    Scheduled Pinned Locked Moved Bug Reports
    7 Posts 4 Posters 63 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.
    • CatABCC
      CatABC
      last edited by

      Sampler.setSoundPropertyForSelection(); seems to have a bug.
      When I changed the values ​​of Root, LoKey, and HiKey in the sample from larger to smaller values, the HiKey value with the code 4 did not take effect.
      2025_11_25_03_00_29_64.gif

      //I am a new student at HISE._
      //Windows11 & MacOS Ventura 13.6.7_

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

        @CatABC Use constants instead of magic numbers

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

        ChazroxC CatABCC 2 Replies Last reply Reply Quote 0
        • ChazroxC
          Chazrox @d.healey
          last edited by

          @d-healey There are some rare cases that .setAttribute gives an error if I use param ID instead of a number. Gives an error on only certain things error: "expected int" I think the error is. I'll specifically note them next time and tell you.

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

            @Chazrox said in Sampler.setSoundPropertyForSelection(); seems to have a bug.:

            @d-healey There are some rare cases that .setAttribute gives an error if I use param ID instead of a number. Gives an error on only certain things error: "expected int" I think the error is. I'll specifically note them next time and tell you.

            That means the constant is invalid

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

            1 Reply Last reply Reply Quote 0
            • ulrikU
              ulrik @CatABC
              last edited by

              @CatABC if you change both the low and the highkey downwards you need to change the lo key first and then the hi key, cause it’s not possible to set the hi key below the lowkey

              Hise Develop branch
              MacOs 15.3.1, Xcode 16.2
              http://musikboden.se

              1 Reply Last reply Reply Quote 1
              • CatABCC
                CatABC @d.healey
                last edited by

                @ulrik

                @d-healey said in Sampler.setSoundPropertyForSelection(); seems to have a bug.:

                @CatABC Use constants instead of magic numbers

                Sadly, I tried using constants, but the problem persists. Also, if I swap the positions of HIGH_KEY and LOW_KEY, and need to move the smaller value to the larger value, the contradiction still occurs.

                const var ComboBox1 = Content.getComponent("ComboBox1");
                
                const var ROOT = 2;
                const var LOW_KEY = 3;
                const var HIGH_KEY = 4;
                
                const var C1 = 36;
                const var D1 = 38;
                const var E1 = 40;
                const var B3 = 71;
                inline function onComboBox1Control(component, value)
                {    
                    Sampler.selectSounds("C3");
                    
                    if (value == 1)
                    {
                      	Sampler.setSoundPropertyForSelection(ROOT, C1);      
                        Sampler.setSoundPropertyForSelection(HIGH_KEY, C1);
                        Sampler.setSoundPropertyForSelection(LOW_KEY, C1);
                    }
                    
                    if (value == 2)
                    {    
                        Sampler.setSoundPropertyForSelection(ROOT, D1);   
                        Sampler.setSoundPropertyForSelection(HIGH_KEY,D1);
                        Sampler.setSoundPropertyForSelection(LOW_KEY, D1);
                    }
                    if (value == 3)
                    {    
                        Sampler.setSoundPropertyForSelection(ROOT, E1);   
                        Sampler.setSoundPropertyForSelection(HIGH_KEY,E1);
                        Sampler.setSoundPropertyForSelection(LOW_KEY, E1);
                    }
                    if (value == 4)
                    {    
                        Sampler.setSoundPropertyForSelection(ROOT, B3);
                        Sampler.setSoundPropertyForSelection(LOW_KEY, B3);
                        Sampler.setSoundPropertyForSelection(HIGH_KEY, B3);
                    }
                };
                
                Content.getComponent("ComboBox1").setControlCallback(onComboBox1Control);
                

                //I am a new student at HISE._
                //Windows11 & MacOS Ventura 13.6.7_

                CatABCC 1 Reply Last reply Reply Quote 0
                • CatABCC
                  CatABC @CatABC
                  last edited by

                  @CatABC said in Sampler.setSoundPropertyForSelection(); seems to have a bug.:

                  @ulrik

                  @d-healey said in Sampler.setSoundPropertyForSelection(); seems to have a bug.:

                  @CatABC Use constants instead of magic numbers

                  Sadly, I tried using constants, but the problem persists. Also, if I swap the positions of HIGH_KEY and LOW_KEY, and need to move the smaller value to the larger value, the contradiction still occurs.

                  const var ComboBox1 = Content.getComponent("ComboBox1");
                  
                  const var ROOT = 2;
                  const var LOW_KEY = 3;
                  const var HIGH_KEY = 4;
                  
                  const var C1 = 36;
                  const var D1 = 38;
                  const var E1 = 40;
                  const var B3 = 71;
                  inline function onComboBox1Control(component, value)
                  {    
                      Sampler.selectSounds("C3");
                      
                      if (value == 1)
                      {
                        	Sampler.setSoundPropertyForSelection(ROOT, C1);      
                          Sampler.setSoundPropertyForSelection(HIGH_KEY, C1);
                          Sampler.setSoundPropertyForSelection(LOW_KEY, C1);
                      }
                      
                      if (value == 2)
                      {    
                          Sampler.setSoundPropertyForSelection(ROOT, D1);   
                          Sampler.setSoundPropertyForSelection(HIGH_KEY,D1);
                          Sampler.setSoundPropertyForSelection(LOW_KEY, D1);
                      }
                      if (value == 3)
                      {    
                          Sampler.setSoundPropertyForSelection(ROOT, E1);   
                          Sampler.setSoundPropertyForSelection(HIGH_KEY,E1);
                          Sampler.setSoundPropertyForSelection(LOW_KEY, E1);
                      }
                      if (value == 4)
                      {    
                          Sampler.setSoundPropertyForSelection(ROOT, B3);
                          Sampler.setSoundPropertyForSelection(LOW_KEY, B3);
                          Sampler.setSoundPropertyForSelection(HIGH_KEY, B3);
                      }
                  };
                  
                  Content.getComponent("ComboBox1").setControlCallback(onComboBox1Control);
                  

                  Ultimately, I set up two methods to call different methods depending on whether the value in the combobox increases or decreases.😹

                  //I am a new student at HISE._
                  //Windows11 & MacOS Ventura 13.6.7_

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

                  44

                  Online

                  2.1k

                  Users

                  12.9k

                  Topics

                  112.0k

                  Posts